วันจันทร์ที่ 15 พฤศจิกายน พ.ศ. 2553

วันจันทร์ที่ 1 พฤศจิกายน พ.ศ. 2553

Reserved Word

คำสงวน (Reserved Word or Java Keywords)
The following character sequences, formed from ASCII letters, are reserved for use as keywords and cannot be used as identifiers. 1. แบบเรียงอักษร : 49 Java Keywords
abstract boolean break byte case catch
char class const continue default do
double else extends final finally float
for goto if implements import instanceof
int interface long native new package
private protected public return short static
strictfp super switch synchronized this throw
throws transient try void volatile while
assert
2. แบบแยกกลุ่มใหญ่
DATA
1. boolean
2. byte
3. char
4. double
5. final
6. float
7. int
8. long
9. short
10. static
11. strictfp
12. transient
13. void
CONTROL
1. assert
2. break
3. case
4. catch
5. continue
6. default
7. do
8. else
9. finally
10. for
11. if
12. return
13. switch
14. synchronized
15. throw
16. throws
17. try
18. while
OBJECTS
1. abstract
2. class
3. extends
4. implements
5. import
6. instanceof
7. interface
8. native
9. new
10. package
11. private
12. protected
13. public
14. super
15. this
16. volatile
Unused
1. const
2. goto
3. แบบแยกกลุ่มย่อย (9 กลุ่ม = 49 keywords) 1. Access Modifiers private : Makes a method or a variable accessible only from within its own class. protected : Makes a method or a variable accessible only to classes in the same package or subclasses of the class. public : Makes a class, method, or variable accessible from any other class. 2. Class, Method, and Variable Modifiers abstract : Used to declare a class that cannot be instantiated, or a method that must be implemented by a nonabstract subclass. class : Keyword used to specify a class. extends : Used to indicate the superclass that a subclass is extending. final : Makes it impossible to extend a class, override a method, or reinitialize a variable. implements : Used to indicate the interfaces that a class will implement. interface : Keyword used to specify an interface. native : Indicates a method is written in a platform-dependent language, such as C. new : Used to instantiate an object by invoking the constructor. static : Makes a method or a variable belong to a class as opposed to an instance. strictfp : Used in front of a method or class to indicate that floating-point numbers will follow FP-strict rules in all expressions. synchronized : Indicates that a method can be accessed by only one thread at a time. transient : Prevents fields from ever being serialized. Transient fields are always skipped when objects are serialized. volatile : Indicates a variable may change out of sync because it is used in threads. 3. Flow Control break : Exits from the block of code in which it resides. case : Executes a block of code, dependent on what the switch tests for. continue : Stops the rest of the code following this statement from executing in a loop and then begins the next iteration of the loop. default : Executes this block of code if none of the switch-case statements match. do : Executes a block of code one time, then, in conjunction with the while statement, it performs a test to determine whether the block should be executed again. else : Executes an alternate block of code if an if test is false. for : Used to perform a conditional loop for a block of code. if : Used to perform a logical test for true or false. instanceof : Determines whether an object is an instance of a class, superclass, or interface. return : Returns from a method without executing any code that follows the statement (can optionally return a variable). switch : Indicates the variable to be compared with the case statements. while : Executes a block of code repeatedly while a certain condition is true. 4. Error Handling catch : Declares the block of code used to handle an exception. finally : Block of code, usually following a try-catch statement, which is executed no matter what program flow occurs when dealing with an exception. throw : Used to pass an exception up to the method that called this method. throws : Indicates the method will pass an exception to the method that called it. try : Block of code that will be tried, but which may cause an exception. assert : Evaluates a conditional expression to verify the programmer’s assumption. 5. Package Control import : Statement to import packages or classes into code. package : Specifies to which package all classes in a source file belong. 6. Primitives boolean : A value indicating true or false. byte : An 8-bit integer (signed). char : A single Unicode character (16-bit unsigned) double : A 64-bit floating-point number (signed). float : A 32-bit floating-point number (signed). int : A 32-bit integer (signed). long : A 64-bit integer (signed). short : A 16-bit integer (signed). 7. Variable Keywords super : Reference variable referring to the immediate superclass. this : Reference variable referring to the current instance of an object. 8. Void Return Type Keyword void : Indicates no return type for a method. 9. Unused Reserved Words const : Do not use to declare a constant; use public static final. goto : Not implemented in the Java language. It’s considered harmful.

c keyword

autobreakcasecharconstcontinuedefaultdodoubleelseenumexternfloatforgotoifintlongregisterreturnshortsignedsizeofstaticstructswitchtypedefunionunsignedvoidvolatilewhile
In addition to these standard keywords, TIGCC recognizes some extended keywords which do not exist in ANSI C, like asm, typeof, inline, etc., which are described in details in the section GNU C language extensions. This section also describes extensions to standard keywords, not only new ones. Note: If square brackets '[...]' are used in syntax descriptions, they mean optional arguments (as usual in syntax-describing languages), not square brackets as literals.
auto
Defines a local variable as having a local lifetime.
Keyword auto uses the following syntax:[auto] data-definition;
As the local lifetime is the default for local variables, auto keyword is extremely rarely used. Note: GNU C extends auto keyword to allow forward declaration of nested functions.
break
Passes control out of the compound statement.
The break statement causes control to pass to the statement following the innermost enclosing while, do, for, or switch statement. The syntax is simplybreak;
const
Makes variable value or pointer parameter unmodifiable.
When const is used with a variable, it uses the following syntax:const variable-name [ = value];
In this case, the const modifier allows you to assign an initial value to a variable that cannot later be changed by the program. For example,const my_age = 32;
Any assignments to 'my_age' will result in a compiler error. However, such declaration is quite different than using#define my_age 32
In the first case, the compiler allocates a memory for 'my_age' and stores the initial value 32 there, but it will not allow any later assignment to this variable. But, in the second case, all occurences of 'my_age' are simply replaced with 32 by the preprocessor, and no memory will be allocated for it. Warning: a const variable can be indirectly modified by a pointer, as in the following example:*(int*)&my_age = 35;
When the const modifier is used with a pointer parameter in a function's parameter list, it uses the following syntax:function-name (const type *var-name)
Then, the function cannot modify the variable that the pointer points to. For example,int printf (const char *format, ...);
Here the printf function is prevented from modifying the format string.
continue
Passes control to the begining of the loop.
continue causes control to pass to the end of the innermost enclosing while, do, or for statement, at which point the loop continuation condition is re-evaluated. The syntax is simplycontinue;
For example,for (i = 0; i < 20; i++)
{
if (array[i] == 0)
continue;
array[i] = 1/array[i];
}
This example changes each element in the array with its reciprocal, but skips elements which are equal to zero.
do
Do-while loop.
Keyword do is usually used together with while to make another form of repeating statement. Such form of the loop uses the following syntax:do statement while (expression)
statement, which is usually a compound statement, is executed repeatedly as long as the value of expression remains non-zero. The test takes place after each execution of the statement. For example,i = 1; n = 1;
do
{
n *= i;
i++;
} while (i <= factorial);
enum
Defines a set of constants of type int.
The syntax for defining constants using enum isenum [tag] {name [=value], ...};
The set can optionally be given a type tag name with tag. name is the name of a constant that can optionally be assigned the (constant) value of value, etc. For example,enum Numbers {One = 1, Two = 2, Three = 3, Four = 4, Five = 5};
If value is missing, then a value is assumed to be the value of the previous constant in the list + 1. If this is the first constant in the list, the default value is 0. If you give a type tag name, then you can declare variables of enumerated type usingenum tag variable-names;
For example,enum Numbers x, y, z;
declares three variables x, y and z, all of type Numbers (they are, in fact, integer variables). More precise, 'enum tag' becomes a new type which is equal in rights with any built-in type.
extern
Indicates that an identifier is defined elsewhere.
Keyword extern indicates that the actual storage and initial value of a variable, or body of a function, is defined elsewhere, usually in a separate source code module. So, it may be applied to data definitions and function prototypes:extern data-definition;
extern function-prototype;
For example,extern int _fmode;
extern void Factorial (int n);
The keyword extern is optional (i.e. default) for a function prototype.
float, double
Floating point data types.
The keyword float usually represents a single precision floating point data type, and double represents a double precision floating point data type. In TIGCC, both float and double (and even long double) are the same. The TI-89 and TI-92 Plus use a non-IEEE floating point format called SMAP II BCD for floating point values. These values have a range from 1e-999 to 9.999999999999999e999 in magnitude, with a precision of exactly 16 significant digits. Principally, the exponent range may be as high as 16383, but a lot of math routines do not accept exponents greater than 999.
for
For loop.
For-loop is yet another kind of loop. It uses for keyword, with the following syntax:for ([expr1]; [expr2]; [expr3]) statement
statement is executed repeatedly until the value of expr2 is 0. Before the first iteration, expr1 is evaluated. This is usually used to initialize variables for the loop. After each iteration of the loop, expr3 is evaluated. This is usually used to increment a loop counter. In fact, the for-loop is absolutely equivalent to the following sequence of statements:expr1;
while (expr2)
{
statement;
expr3;
}
That's why expr1 and expr3 must contain side effects, else they are useless. For example,for (i=0; i<100; i++) sum += x[i];
for (i=0, t=string; i<40 && *t; i++, t++) putch(*t);
putch('\n');
for (i=0, sum=0, sumsq=0, i<100; i++)
{
sum += i; sumsq += i*i;
}
All the expressions are optional. If expr2 is left out, it is assumed to be 1. statement may be a compound statement as well.
goto
Unconditionally transfer control.
goto may be used for transfering control from one place to another. The syntax is:goto identifier;
Control is unconditionally transferred to the location of a local label specified by identifier. For example,Again:
...
goto Again;
Jumping out of scope (for example out of the body of the for loop) is legal, but jumping into a scope (for example from one function to another) is not allowed. Note: The GNU C extends the usage of goto keyword to allow computed goto. Also, it supports local labels, useful in macro definitions.
if, else
Conditional statement.
Keyword if is used for conditional execution. The basic form of if uses the following syntax:if (expression)
statement1
Alternatively, if may be used together with else, using the following syntax:if (expression)
statement1
else
statement2
If expression is nonzero when evaluated, then statement1 is executed. In the second case, statement2 is executed if the expression is 0. An optional else can follow an if statement, but no statements can come between an if statement and an else. Of course, both statement1 and statement2 may be compound statements (i.e. a sequence of statements enclosed in braces). Here will be given some legal examples:if (count < 50) count++;
if (x < y) z = x;
else z = y;
if (x < y)
{
printf ("x is smaller");
return x;
}
else
{
printf ("x is greater")
return y;
}
The #if and #else preprocessor statements look similar to the if and else statements, but have very different effects. They control which source file lines are compiled and which are ignored.
int, char
Basic data types (integer and character).
Variables of type int are one machine-type word in length. They can be signed (default) or unsigned, which means that in this configuration of the compiler they have by default a range of -32768 to 32767 and 0 to 65535 respectively, but this default may be changed if the compiler option '-mnoshort' is given. In this case, the range of type int is -2147483648 to 2147483647 for signed case, or 0 to 4294967295 for unsigned case. See also short and long type modifiers. Variables of type char are 1 byte in length. They can be signed (this is the default, unless you use the compiler option '-funsigned-char') or unsigned, which means they have a range of -128 to 127 and 0 to 255, respectively. All data types may be used for defining variables, specifying return types of functions, and specifying types of function arguments. For example,int a, b, c; // 'a', 'b', 'c' are integer variables
int func (); // 'func' is a function returning int
char crypt (int key, char value); // 'crypt' is a function returning char with
// two args: 'key' is int and 'value' is char
When function return type is omitted, int is assumed. All data type keywords may be used in combination with asterisks, brackets and parentheses, for making complex data types, like pointer types, array types, function types, or combinations of them, which in the C language may have an arbitrary level of complexity (see asterisk for more info).
register
Tells the compiler to store the variable being declared in a CPU register.
In standard C dialects, keyword auto uses the following syntax:register data-definition;
The register type modifier tells the compiler to store the variable being declared in a CPU register (if possible), to optimize access. For example,register int i;
Note that TIGCC will automatically store often used variables in CPU registers when the optimization is turned on, but the keyword register will force storing in registers even if the optimization is turned off. However, the request for storing data in registers may be denied, if the compiler concludes that there is not enough free registers for use at this place. Note: The GNU C extends the usage of register keyword to allow explicitely choosing of used registers.
return
Exits the function.
return exits immediately from the currently executing function to the calling routine, optionally returning a value. The syntax is:return [expression];
For example,int sqr (int x)
{
return (x*x);
}
short, long, signed, unsigned
Type modifiers.
A type modifier alters the meaning of the base type to yield a new type. Each of these type modifiers can be applied to the base type int. The modifiers signed and unsigned can be applied to the base type char. In addition, long can be applied to double. When the base type is omitted from a declaration, int is assumed. For example,long x; // 'int' is implied
unsigned char ch;
signed int i; // 'signed' is default
unsigned long int l; // 'int' is accepted, but not needed
In this implementation of the compiler, the valid range of valid data types is as listed in the following table:short int -32768 to 32767
long int -2147483648 to 2147483647
signed char -128 to 127
signed int -32768 to 32767 (signed is default)
[or -2147483648 to 2147483647 if '-mnoshort' is given]
signed short int -32768 to 32767
signed long int -2147483648 to 2147483647
unsigned char 0 to 255
unsigned int 0 to 65535
[or 0 to 4294967295 if '-mnoshort' is given]
unsigned short int 0 to 65535
unsigned long int 0 to 4294967295
Note: GNU C extends the long keyword to allow double-long integers (64-bit integers in this implementation), so they have range from -9223372036854775808 to 9223372036854775807 if signed, or from 0 to 18446744073709551615 if unsigned.
sizeof
Returns the size of the expression or type.
Keyword sizeof is, in fact, an operator. It returns the size, in bytes, of the given expression or type (as type size_t). Its argument may be an expression of a type name:sizeof expression
sizeof (type)
For example,workspace = calloc (100, sizeof (int));
memset(buff, 0, sizeof buff);
nitems = sizeof (table) / sizeof (table[0]);
Note that type may be an anonymous type (see asterisk for more info about anonymous types).
static
Preserves variable value to survive after its scope ends.
Keyword static may be applied to both data and function definitions:static data-definition;
static function-definition;
For example,static int i = 10;
static void PrintCR (void) { putc ('\n'); }
static tells that a function or data element is only known within the scope of the current compile. In addition, if you use the static keyword with a variable that is local to a function, it allows the last value of the variable to be preserved between successive calls to that function. Note that the initialization of automatic and static variables is quite different. Automatic variables (local variables are automatic by default, except you explicitely use static keyword) are initialized during the run-time, so the initialization will be executed whenever it is encountered in the program. Static (and global) variables are initialized during the compile-time, so the initial values will simply be embeded in the executable file itself. If you change them, they will retain changed in the file. By default, the C language proposes that all uninitialized static variables are initialized to zero, but due to some limitations in TIGCC linker, you need to initialize explicitely all static and global variables if you compile the program in "nostub" mode. The fact that global and static variables are initialized in compile-time and kept in the executable file itself has one serious consequence, which is not present on "standard" computers like PC, Mac, etc. Namely, these computers always reload the executable on each start from an external memory device (disk), but this is not the case on TI. So, if you have the following global (or static) variableint a = 10;
and if you change its value somewhere in the program to 20 (for example), its initial value will be 20 (not 10) on the next program start! Note that this is true only for global and static variables. To force reinitializing, you must put explicitely something likea = 10;
at the begining of the main program! Note, however, that if the program is archived, the initial values will be restored each time you run the program, because archived programs are reloaded from the archive memory to the RAM on each start, similarly like the programs are reloaded from disks on "standard" computers each time when you start them.
struct
Groups variables into a single record.
The syntax for defining records is:struct [struct-type-name]
{
[type variable-names] ;
...
} [structure-variables] ;
A struct, like an union, groups variables into a single record. The struct-type-name is an optional tag name that refers to the structure type. The structure-variables are the data definitions, and are also optional. Though both are optional, one of the two must appear. Elements in the record are defined by naming a type, followed by variable-names separated by commas. Different variable types can be separated by a semicolon. For example,struct my_struct
{
char name[80], phone_number[80];
int age, height;
} my_friend;
declares a record variable my_friend containing two strings (name and phone_number) and two integers (age and height). To declare additional variables of the same type, you use the keyword struct followed by the struct-type-name, followed by the variable names. For example,struct my_struct my_friends[100];
declares an array named my_friends which components are records. In fact, 'struct my_struct' becomes a new type which is equal in rights with any built-in type. To access elements in a structure, you use a record selector ('.'). For example,strcpy (my_friend.name, "Mr. Wizard");
A bit field is an element of a structure that is defined in terms of bits. Using a special type of struct definition, you can declare a structure element that can range from 1 to 16 bits in length. For example,struct bit_field
{
int bit_1 : 1;
int bits_2_to_5 : 4;
int bit_6 : 1;
int bits_7_to_16 : 10;
} bit_var;
switch, case, default
Branches control.
switch causes control to branch to one of a list of possible statements in the block of statements. The syntax isswitch (expression) statement
The statement statement is typically a compound statement (i.e. a block of statements enclosed in braces). The branched-to statement is determined by evaluating expression, which must return an integral type. The list of possible branch points within statement is determined by preceding substatements withcase constant-expression :
where constant-expression must be an int and must be unique. Once a value is computed for expression, the list of possible constant-expression values determined from all case statements is searched for a match. If a match is found, execution continues after the matching case statement and continues until a break statement is encountered or the end of statement is reached. If a match is not found and this statement prefix is found within statement,default :
execution continues at this point. Otherwise, statement is skipped entirely. For example,switch (operand)
{
case MULTIPLY:
x *= y; break;
case DIVIDE:
x /= y; break;
case ADD:
x += y; break;
case SUBTRACT:
x -= y; break;
case INCREMENT2:
x++;
case INCREMENT1:
x++; break;
case EXPONENT:
case ROOT:
case MOD:
printf ("Not implemented!\n");
break;
default:
printf("Bug!\n");
exit(1);
}
See also break. Note: GNU C extends the case keyword to allow case ranges.
typedef
Creates a new type.
The syntax for defining a new type istypedef type-definition identifier;
This statement assigns the symbol name identifier to the data type definition type-definition. For example,typedef unsigned char byte;
typedef char str40[41];
typedef struct {float re, im;} complex;
typedef char *byteptr;
typedef int (*fncptr)(int);
After these definition, you can declarebyte m, n;
str40 myStr;
complex z1, z2;
byteptr p;
fncptr myFunc;
with the same meaning as you declareunsigned char m, n;
char myStr[41];
struct {float re, im;} z1, z2;
char *p;
int (*myFunc)(int);
User defined types may be used at any place where the built-in types may be used.
union
Groups variables which share the same storage space.
A union is similar to a struct, except it allows you to define variables that share storage space. The syntax for defining unions is:union [union-type-name]
{
type variable-names;
...
} [union-variables] ;
For example,union short_or_long
{
short i;
long l;
} a_number;
The compiler will allocate enough storage in a number to accommodate the largest element in the union. Elements of a union are accessed in the same manner as a struct. Unlike a struct, the variables 'a_number.i' and 'a_number.l' occupy the same location in memory. Thus, writing into one will overwrite the other.
void
Empty data type.
When used as a function return type, void means that the function does not return a value. For example,void hello (char *name)
{
printf("Hello, %s.", name);
}
When found in a function heading, void means the function does not take any parameters. For example,int init (void)
{
return 1;
}
This is not the same as definingint init ()
{
return 1;
}
because in the second case the compiler will not check whether the function is really called with no arguments at all; instead, a function call with arbitrary number of arguments will be accepted without any warnings (this is implemented only for the compatibility with the old-style function definition syntax). Pointers can also be declared as void. They can't be dereferenced without explicit casting. This is because the compiler can't determine the size of the object the pointer points to. For example,int x;
float f;
void *p = &x; // p points to x
*(int*)p = 2;
p = &r; // p points to r
*(float*)p = 1.1;
volatile
Indicates that a variable can be changed by a background routine.
Keyword volatile is an extreme opposite of const. It indicates that a variable may be changed in a way which is absolutely unpredictable by analysing the normal program flow (for example, a variable which may be changed by an interrupt handler). This keyword uses the following syntax:volatile data-definition;
Every reference to the variable will reload the contents from memory rather than take advantage of situations where a copy can be in a register.
while
Repeats execution while the condition is true.
Keyword while is the most general loop statemens. It uses the following syntax:while (expression) statement
statement is executed repeatedly as long as the value of expression remains nonzero. The test takes place before each execution of the statement. For example,while (*p == ' ') p++;
Of course, statement may be a compound statement as well.

วันจันทร์ที่ 16 สิงหาคม พ.ศ. 2553

ไวรัสคอมพิวเตอร์คืออะไร

ไวรัสคืออะไร

ไวรัส คือโปรแกรมชนิดหนึ่งที่มีความสามารถในการสำเนาตัวเองเข้าไปติดอยู่ในระบบคอมพิวเตอร์ได้และถ้ามีโอกาสก็สามารถแทรกเข้าไประบาดในระบบคอมพิวเตอร์อื่น ๆ ซึ่งอาจเกิดจากการนำเอาดิสก์ที่ติดไวรัสจากเครื่องหนึ่งไปใช้อีกเครื่องหนึ่ง หรืออาจผ่านระบบเครือข่ายหรือระบบสื่อสารข้อมูลไวรัสก็อาจแพร่ระบาดได้เช่นกัน
การที่คอมพิวเตอร์ใดติดไวรัส หมายถึงว่าไวรัสได้เข้าไปผังตัวอยู่ในหน่วยความจำ คอมพิวเตอร์ เรียบร้อยแล้ว เนื่องจากไวรัสก็เป็นแค่โปรแกรม ๆ หนึ่งการที่ไวรัสจะเข้าไปอยู่ ในหน่วยความจำได้นั้นจะต้องมีการถูกเรียกให้ทำงานได้นั้นยังขึ้นอยู่กับประเภทของไวรัส แต่ละตัวปกติผู้ใช้มักจะไม่รู้ตัวว่าได้ทำการปลุกคอมพิวเตอร์ไวรัสขึ้นมาทำงานแล้ว
จุดประสงค์ของการทำงานของไวรัสแต่ละตัวขึ้นอยู่กับตัวผู้เขียนโปรแกรมไวรัสนั้น เช่น อาจสร้างไวรัสให้ไปทำลายโปรแกรมหรือข้อมูลอื่น ๆ ที่อยู่ในเครื่องคอมพิวเตอร์ หรือ แสดงข้อความวิ่งไปมาบน หน้าจอ เป็นต้น

ประเภทของไวรัส

บูตเซกเตอร์ไวรัส
Boot Sector Viruses หรือ Boot Infector Viruses คือไวรัสที่เก็บตัวเองอยู่ในบูตเซกเตอร์ ของดิสก์ การใช้งานของบูตเซกเตอร์คือ เมื่อเครื่องคอมพิวเตอร์เริ่มทำงานขึ้นมาตอนแรก เครื่อง จะเข้าไปอ่านบูตเซกเตอร์ โดยในบูตเซกเตอร์จะมีโปรแกรมเล็ก ๆ ไว้ใช้ในการเรียกระบบ ปฎิบัติการขึ้นมาทำงานอีกทีหนึ่ง บูตเซกเตอร์ไวรัสจะเข้าไปแทนที่โปรแกรมดังกล่าว และไวรัส ประเภทนี้ถ้าไปติดอยู่ในฮาร์ดดิสก์ โดยทั่วไป จะเข้าไปอยู่บริเวณที่เรียกว่า Master Boot Sector หรือ Parition Table ของฮาร์ดดิสก์นั้น
ถ้าบูตเซกเตอร์ของดิสก์ใดมีไวรัสประเภทนี้ติดอยู่ ทุก ๆ ครั้งที่บูตเครื่องขึ้นมาโดย พยายามเรียก ดอสจากดิสก์นี้ ตัวโปรแกรมไวรัสจะทำงานก่อนและจะเข้าไปฝังตัวอยู่ใน หน่วยความจำเพื่อเตรียมพร้อมที่ จะทำงานตามที่ได้ถูกโปรแกรมมา แล้วตัวไวรัสจึงค่อยไป เรียกดอสให้ขึ้นมาทำงานต่อไป ทำให้เหมือนไม่มีอะไรเกิดขึ้น

โปรแกรมไวรัส

Program Viruses หรือ File Intector Viruses เป็นไวรัสอีกประเภทหนึ่งที่จะติดอยู่กับโปรแกรม ซึ่งปกติก็คือ ไฟล์ที่มีนามสกุลเป็น COM หรือ EXE และบางไวรัสสามารถเข้า ไปติดอยู่ในโปรแกรมที่มีนามสกุลเป็น sys และโปรแกรมประเภท Overlay Programsได้ด้วย โปรแกรมโอเวอร์เลย์ปกติจะเป็นไฟล์ที่มีนามสกุลที่ขึ้นต้นด้วย OV วิธีการที่ไวรัสใช้เพื่อที่จะ เข้าไปติดโปรแกรมมีอยู่สองวิธี คือ การแทรกตัวเองเข้าไปอยู่ในโปรแกรมผลก็คือหลังจากท ี่ โปรแกรมนั้นติดไวรัสไปแล้ว ขนาดของโปรแกรมจะใหญ่ขึ้น หรืออาจมีการสำเนาตัวเองเข้าไปทับส่วนของโปรแกรมที่มีอยู่เดิมดังนั้นขนาดของโปรแกรมจะไม่เปลี่ยนและยากที่ จะซ่อมให้กลับเป็นดังเดิม
การทำงานของไวรัส โดยทั่วไป คือ เมื่อมีการเรียกโปรแกรมที่ติดไวรัส ส่วนของไวรัสจะทำงานก่อนและจะถือโอกาสนี้ฝังตัวเข้าไปอยู่ในหน่วยความจำทันทีแล้วจึงค่อยให้ โปรแกรมนั้นทำงานตามปกติต่อไป เมื่อไวรัสเข้าไปฝังตัวอยู่ในหน่วยความจำแล้ว หลัง จากนี้ไปถ้ามีการเรียกโปรแกรมอื่น ๆ ขึ้นมาทำงานต่อ ตัวไวรัสก็จะสำเนาตัวเองเข้าไป ในโปรแกรมเหล่านี้ทันที เป็นการแพร่ระบาดต่อไป
วิธีการแพร่ระบาดของโปรแกรม ไวรัสอีกแบบหนึ่งคือ เมื่อมีการเรียกโปรแกรมที่มีไวรัสติดอยู่ ตัวไวรัสจะเข้าไปหาโปรแกรมอื่น ๆ ที่อยู่ในดิสก์เพื่อทำสำเนาตัวเองลงไปทันทีแล้วจึงค่อยให้โปรแกรมที่ถูกเรียก นั้นทำงานตามปกติต่อไป

ม้าโทรจัน

ม้าโทรจัน (Trojan Horse) เป็นโปรแกรมที่ถูกเขียนขึ้นมาให้ทำตัวเหมือนว่าเป็น โปรแกรมธรรมดาทั่ว ๆ ไป เพื่อหลอกล่อผู้ใช้ให้ทำการเรียกขึ้นมาทำงาน แต่เมื่อ ถูกเรียกขึ้นมาแล้ว ก็จะเริ่มทำลายตามที่โปรแกรมมาทันที ม้าโทรจันบางตัวถูกเขียนขึ้นมาใหม่ทั้ง ชุด โดยคนเขียนจะทำการตั้งชื่อโปรแกรมพร้อมชื่อรุ่นและคำอธิบายการใช้งานที่ดูสมจริง เพื่อหลอกให้คนที่จะเรียกใช้ตายใจ
จุดประสงค์ของคนเขียนม้าโทรจันอาจจะเช่นเดียวกับคนเขียนไวรัส คือ เข้าไปทำ อันตรายต่อข้อมูลที่มีอยู่ในเครื่อง หรืออาจมีจุดประสงค์เพื่อที่จะล้วงเอาความลับของระบบ คอมพิวเตอร์
ม้าโทรจันนี้อาจจะถือว่าไม่ใช่ไวรัส เพราะเป็นโปรแกรมที่ถูกเขียนขึ้นมาโดด ๆ และจะไม่มีการเข้าไปติดในโปรแกรมอื่นเพื่อสำเนาตัวเอง แต่จะใช้ความรู้เท่าไม่ถึงการณ์ของ ผู้ใช้เป็นตัวแพร่ระบาดซอฟต์แวร์ที่มีม้าโทรจันอยู่ในนั้นและนับว่าเป็นหนึ่งในประเภทของโปรแกรม ที่มีความอันตรายสูง เพราะยากที่จะตรวจสอบและสร้างขึ้นมาได้ง่าย ซึ่งอาจใช้แค่แบตซ์ไฟล์ก็สามารถโปรแกรมประเภทม้าโทรจันได้

โพลีมอร์ฟิกไวรัส

Polymorphic Viruses เป็นชื่อที่ใช้ในการเรียกไวรัสที่มีความสามารถในการแปรเปลี่ยนตัวเอง ได้เมื่อมีสร้างสำเนาตัวเองเกิดขึ้น ซึ่งอาจได้หถึงหลายร้อยรูปแบบ ผลก็คือ ทำให้ไวรัสเหล่านี้ยากต่อการถูกตรวจจับ โดยโปรแกรมตรวจหาไวรัสที่ใช้วิธีการสแกนอย่างเดียว ไวรัสใหม่ ๆ ในปัจจุบันที่มีความสามารถนี้เริ่มมีจำนวนเพิ่มมากขึ้นเรื่อย ๆ

สทีลต์ไวรัส

Stealth Viruses เป็นชื่อเรียกไวรัสที่มีความสามารถในการพรางตัวต่อการตรวจจับได้ เช่น ไฟล์อินเฟกเตอร์ ไวรัสประเภทที่ไปติดโปรแกรมใดแล้วจะทำให้ขนาดของ โปรแกรมนั้นใหญ่ขึ้น ถ้าโปรแกรมไวรัสนั้นเป็นแบบสทีลต์ไวรัส จะไม่สามารถตรวจดูขนาดที่แท้จริง ของโปรแกรมที่เพิ่มขึ้นได้ เนื่องจากตัว ไวรัสจะเข้าไปควบคุมดอส เมื่อมีการใช้คำสั่ง DIR หรือโปรแกรมใดก็ตามเพื่อตรวจดูขนาดของโปรแกรม ดอสก็จะแสดงขนาดเหมือนเดิม ทุกอย่างราวกับว่าไม่มีอะไรเกิดขึ้น

อาการของเครื่องที่ติดไวรัส

สามารถสังเกตุการทำงานของเครื่องคอมพิวเตอร์ถ้ามีอาการดังต่อไปนี้อาจเป็นไปได้ว่าได้มีไวรัสเข้าไปติดอยู่ในเครื่องแล้ว อาการที่ว่านั้นได้แก่

การตรวจหาไวรัส

การสแกน
โปรแกรมตรวจหาไวรัสที่ใช้วิธีการสแกน (Scanning) เรียกว่า สแกนเนอร์ (Scanner) โดยจะมีการดึงเอาโปรแกรมบางส่วนของตัวไวรัสมาเก็บไว้เป็นฐานข้อมูล ส่วนที่ดึงมานั้นเราเรียกว่า ไวรัสซิกเนเจอร์ (VirusSignature)และเมื่อสแกนเนอร์ถูกเรียกขึ้นมาทำงานก็จะเข้าตรวจหาไวรัสในหน่วยความจำ บูตเซกเตอร์และไฟล์โดยใช้ ไวรัสซิกเนเจอร์ที่มีอยู่
ข้อดีของวิธีการนี้ก็คือ เราสามารถตรวจสอบซอฟแวร์ที่มาใหม่ได้ทันทีเลยว่าติดไวรัสหรือไม่ เพื่อป้องกันไม่ให้ไวรัสถูกเรียกขึ้นมาทำงานตั้งแต่เริ่มแรก แต่วิธีนี้มีจุดอ่อนอยู่หลายข้อ คือ
  1. ฐานข้อมูลที่เก็บไวรัสซิกเนเจอร์จะต้องทันสมัยอยู่เสมอ แลครอบคลุมไวรัสทุกตัว มากที่สุดเท่าที่จะทำได้
  2. เพราะสแกนเนอร์จะไม่สามารถตรวจจับไวรัสที่ยังไม่มี ซิกเนเจอร์ของไวรัสนั้นเก็บอยู่ในฐานข้อมูลได้
  3. ยากที่จะตรวจจับไวรัสประเภทโพลีมอร์ฟิก เนื่องจากไวรัสประเภทนี้เปลี่ยนแปลง ตัวเองได้
  4. จึงทำให้ไวรัสซิกเนเจอร์ที่ใช้สามารถนำมาตรวจสอบได้ก่อนที่ไวรัส จะเปลี่ยนตัวเองเท่านั้น
  5. ถ้ามีไวรัสประเภทสทีลต์ไวรัสติดอยู่ในเครื่องตัวสแกนเนอร์อาจจะไม่สามารถ ตรวจหาไวรัสนี้ได้
  6. ทั้งนี้ขึ้นอยู่กับความฉลาดและเทคนิคที่ใช้ของตัวไวรัสและ ของตัวสแกนเนอร์เองว่าใครเก่งกว่า
  7. เนื่องจากไวรัสมีตัวใหม่ ๆ ออกมาอยู่เสมอ ๆ ผู้ใช้จึงจำเป็นจะต้องหาสแกนเนอร์ ตัวที่ใหม่ที่สุดมาใช้
  8. มีไวรัสบางตัวจะเข้าไปติดในโปรแกรมทันทีที่โปรแกรมนั้นถูกอ่าน และถ้าสมมติ
  9. ว่าสแกนเนอร์ที่ใช้ไม่สามารถตรวจจับได้ และถ้าเครื่องมีไวรัสนี้ติดอยู่ เมื่อมีการ
  10. เรียกสแกนเนอร์ขึ้นมาทำงาน สแกนเนอร์จะเข้าไปอ่านโปรแกรมทีละโปรแกรม เพื่อตรวจสอบ
  11. ผลก็คือจะทำให้ไวรัสตัวนี้เข้าไปติดอยู่ในโปรแกรมทุกตัวที่ถูก สแกนเนอร์นั้นอ่านได้
  12. สแกนเนอร์รายงานผิดพลาดได้ คือ ไวรัสซิกเนเจอร์ที่ใช้บังเอิญไปตรงกับที่มี
  13. อยู่ในโปรแกรมธรรมดาที่ไม่ได้ติดไวรัส ซึ่งมักจะเกิดขึ้นในกรณีที่ไวรัสซิกเนเจอร์ ที่ใช้มีขนาดสั้นไป
  14. ก็จะทำให้โปรแกรมดังกล่าวใช้งานไม่ได้อีกต่อไป

การตรวจการเปลี่ยนแปลง

การตรวจการเปลี่ยนแปลง คือ การหาค่าพิเศษอย่างหนึ่งที่เรียกว่า เช็คซัม (Checksum) ซึ่งเกิดจากการนำเอาชุดคำสั่งและ ข้อมูลที่อยู่ในโปรแกรมมาคำนวณ หรืออาจใช้ข้อมูลอื่น ๆ ของไฟล์ ได้แก่ แอตริบิวต์ วันและเวลา เข้ามารวมในการคำนวณด้วย เนื่องจากทุกสิ่งทุกอย่าง ไม่ว่าจะเป็นคำสั่งหรือข้อมูลที่อยู่ในโปรแกรม จะถูกแทนด้วยรหัสเลขฐานสอง เราจึงสามารถนำเอาตัวเลขเหล่านี้มาผ่านขั้นตอนการคำนวณทางคณิตศาสตร์ได้ ซึ่งวิธีการคำนวณเพื่อหาค่าเช็คซัมนี้มีหลายแบบ และมีระดับการตรวจสอบแตกต่างกันออกไป เมื่อตัวโปรแกรม ภายในเกิดการเปลี่ยนแปลง ไม่ว่าไวรัสนั้นจะใช้วิธีการแทรกหรือเขียนทับก็ตาม เลขที่ได้จากการคำนวณครั้งใหม่ จะเปลี่ยนไปจากที่คำนวณได้ก่อนหน้านี้
ข้อดีของการตรวจการเปลี่ยนแปลงก็คือ สามารถตรวจจับไวรัสใหม่ ๆ ได้ และยังมีความสามารถในการตรวจจับไวรัสประเภทโพลีมอร์ฟิกไวรัสได้อีกด้วย แต่ก็ยังยากสำหรับสทีลต์ไวรัส ทั้งนี้ขึ้นอยู่กับความฉลาดของโปรแกรมตรวจหาไวรัสเองด้วยว่าจะสามารถถูกหลอกโดยไวรัสประเภทนี้ได้หรือไม่ และมีวิธีการตรวจการเปลี่ยนแปลงนี้จะตรวจจับไวรัสได้ก็ต่อเมื่อไวรัสได้เข้าไปติดอยู่ในเครื่องแล้วเท่านั้น และค่อนข้างเสี่ยงในกรณีที่เริ่มมีการคำนวณหาค่าเช็คซัมเป็นครั้งแรก เครื่องที่ใช้ต้องแน่ใจว่าบริสุทธิ์พอ คือต้องไม่มีโปรแกรมใด ๆ ติดไวรัส มิฉะนั้นค่าที่หาได้จากการคำนวณที่รวมตัวไวรัสเข้าไปด้วย ซึ่งจะลำบากภายหลังในการที่จะตรวจหาไวรัสตัวนี้ต่อไป

การเฝ้าดู

เพื่อที่จะให้โปรแกรมตรวจจับไวรัสสามารถเฝ้าดูการทำงานของเครื่องได้ตลอดเวลานั้น จึงได้มีโปรแกรมตรวจจับไวรัสที่ถูกสร้งขึ้นมาเป็นโปรแกรมแบบเรซิเดนท์หรือ ดีไวซ์ไดรเวอร์ โดยเทคนิคของการเฝ้าดูนั้นอาจใช้วิธีการสแกนหรือตรวจการเปลี่ยนแปลงหรือสองแบบรวมกันก็ได้
การทำงานโดยทั่วไปก็คือ เมื่อซอฟแวร์ตรวจจับไวรัสที่ใช้วิธีนี้ถูกเรียกขึ้นมาทำงานก็จะเข้าไปตรวจในหน่วยความจำของเครื่องก่อนว่ามีไวรัสติดอยู่หรือไม่โดยใช้ไวรัสซิกเนเจอร์ ที่มีอยู่ในฐานข้อมูล จากนั้นจึงค่อยนำตัวเองเข้าไปฝังอยู่ในหน่วยความจำ และต่อไปถ้ามีการเรียกโปรแกรมใดขึ้นมาใช้งาน โปรแกรมเฝ้าดูนี้ก็จะเข้าไปตรวจโปรแกรมนั้นก่อน โดยใช้เทคนิคการสแกนหรือตรวจการเปลี่ยนแปลงเพื่อหาไวรัส ถ้าไม่มีปัญหา ก็จะอนุญาตให้โปรแกรมนั้นขึ้นมาทำงานได้ นอกจากนี้โปรแกรมตรวจจับ ไวรัสบางตัวยังสามารถตรวจสอบขณะที่มีการคัดลอกไฟล์ได้อีกด้วย
ข้อดีของวิธีนี้คือ เมื่อมีการเรียกโปรแกรมใดขึ้นมา โปรแกรมนั้นจะถูกตรวจสอบก่อนทุกครั้งโดยอัตโนมัติ ซึ่งถ้าเป็นการใช้สแกนเนอร์ จะสามารถทราบได้ว่าโปรแกรมใดติดไวรัสอยู่ ก็ต่อเมื่อทำการเรียกสแกนเนอร์นั้นขึ้นมาทำงานก่อนเท่านั้น
ข้อเสียของโปรแกรมตรวจจับไวรัสแบบเฝ้าดูก็คือ จะมีเวลาที่เสียไปสำหรับการตรวจหาไวรัสก่อนทุกครั้ง และเนื่องจากเป็นโปรแกรมแบบเรซิเดนท์หรือดีไวซ์ไดรเวอร์ จึงจำเป็นจะต้องใช้หน่วยความจำส่วนหนึ่งของเครื่องตลอดเวลาเพื่อทำงาน ทำให้หน่วยความจำในเครื่องเหลือน้อยลง และเช่นเดียวกับสแกนเนอร์ ก็คือ จำเป็นจะต้องมีการปรับปรุง ฐานข้อมูลของไวรัสซิกเนเจอร์ให้ทันสมัยอยู่เสมอ

คำแนะนำและการป้องกันไวรัส

การกำจัดไวรัส

เมื่อแน่ใจว่าเครื่องติดไวรัสแล้ว ให้ทำการแก้ไขด้วยความใคร่ครวญและระมัดระวังอย่างมาก เพราะบางครั้งตัวคนแก้เองจะเป็นตัวทำลายมากกว่าตัวไวรัสจริง ๆ เสียอีก การฟอร์แมตฮาร์ดดิสก์ใหม่อีกครั้งก็ไม่ใช่ วิธีที่ดีที่สุดเสมอไป ยิ่งแย่ไปกว่านั้นถ้าทำไปโดยยังไม่ได้มีการสำรองข้อมูลขึ้นมาก่อน การแก้ไขนั้นถ้าผู้ใช้มีความรู้เกี่ยวกับไวรัสที่ กำลังติดอยู่ว่าเป็นประเภทใดก็จะช่วยได้อย่างมาก และข้อเสนอแนะต่อไปนี้อาจจะมีประโยชน์ต่อท่าน

บูตเครื่องใหม่ทันทีที่ทราบว่าเครื่องติดไวรัส

เมื่อทราบว่าเครื่องติดไวรัส ให้ทำการบูตเครื่องใหม่ทันที โดยเรียกดอสขึ้นมาทำงานจากฟลอปปีดิสก์ที่ได้เตรียมไว้ เพราะถ้าไปเรียกดอสจากฮาร์ดดิสก์ เป็นไปได้ว่า ตัวไวรัสอาจกลับเข้าไปในหน่วยความจำได้อีก เมื่อเสร็จขั้นตอนการเรียกดอสแล้ว ห้ามเรียกโปรแกรมใด ๆ ก็ตามในดิสก์ที่ติดไวรัส เพราะไม่ทราบว่าโปรแกรมใดบ้างที่มีไวรัสติดอยู่

เรียกโปรแกรมจัดการไวรัสขั้นมาตรวจหาและทำลาย

ให้เรียกโปรแกรมตรวจจับไวรัส เพื่อตรวจสอบดูว่ามีโปรแกรมใดบ้างติดไวรัส ถ้าโปรแกรมตรวจ หาไวรัสที่ใช้อยู่สามารถกำจัดไวรัสตัวที่พบได้ ก็ให้ลองทำดู แต่ก่อนหน้านี้ให้ทำการคัดลอกเพื่อสำรองโปรแกรมที่ติดไวรัสไปเสียก่อน โดยโปรแกรมจัดการไวรัสบางโปรแกรมสามารถสั่งให้ทำสำรองโปรแกรมที่ติดไวรัสไปเป็นอีกชื่อหนึ่งก่อนที่จะกำจัดไวรัส เช่น MSAV ของดอสเอง เป็นต้น
การทำสำรองก็เพราะว่า เมื่อไวรัสถูกกำจัดออกจากฌปรแกรมไป โปรแกรมนั้นอาจไม่สามารถทำงานได้ตามปกติ หรือทำงานไม่ได้เลยก็เป็นไปได้ วิธีการตรวจขั้นต้นคือ ให้ลอง เปรียบเทียบขนาดของโปรแกรมหลังจากที่ถูกกำจัดไวรัสไปแล้วกับขนาดเดิม ถ้ามีขนาดน้อยกว่า แสดงว่าไม่สำเร็จ หากเป็นเช่นนั้นให้เอาโปรแกรมที่ติดไวรัสที่สำรองไว้ แล้วหาโปรแกรมจัดการ ไวรัสตัวอื่นมาใช้แทน แต่ถ้ามีขนาดมากกว่าหรือเท่ากับของเดิม เป็นไปได้ว่าการกำจัดไวรัสอาจสำเร็จ โดยอาจลองเรียกโปรแกรมตรวจหาไวรัสเพื่อทดสอบโปรแกรมอีกครั้ง
หากผลการตรวจสอบออกมาว่าปลอดเชื้อ ก็ให้ลองเรียกโปรแกรมที่ถูกกำจัดไวรัสไปนั้นขึ้นมาทดสอบการทำงานดูอย่างละเอียดว่าเป็นปกติดีอยู่หรือไม่อีกครั้ง ในช่วงดังกล่าวควรเก็บโปรแกรมนี้ที่สำรองไปขณะที่ติดไวรัสอยู่ไว้ เผื่อว่าภายหลังพบว่าโปรแกรมทำงานไม่เป็นไปตามปกติ ก็สามารถลองเรียกโปรแกรมจัดการไวรัสตัวอื่นขึ้นมากำจัดต่อไปได้ในภายหลัง แต่ถ้าแน่ใจว่าโปรแกรมทำงานเป็นปกติดี ก็ทำการลบโปรแกรมสำรองที่ยังติดไวรัสติดอยู่ทิ้งไปทันที เป็นการป้องกันไม่ให้มีการเรียกขึ้นมาใช้งานภายหลังเพราะความบังเอิญได้

ไวรัสคอมพิวเตอร์



ไวรัสคืออะไร

ไวรัส คือ โปรแกรมชนิดหนึ่งที่มีความสามารถในการสำเนาตัวเองเข้าไปติดอยู่ในระบบ คอมพิวเตอร์ได้ และถ้ามีโอกาสก็สามารถแทรกเข้าไประบาดในระบบคอมพิวเตอร์อื่นๆ ซึ่งอาจเกิดจากการนำเอาดิสก์ที่ติดไวรัสจากเครื่องหนึ่งไปใช้อีกเครื่อง หนึ่ง หรืออาจผ่านระบบเครือข่ายหรือระบบสื่อสารข้อมูล ไวรัสก็อาจแพร่ระบาดได้เช่นกัน
การที่คอมพิวเตอร์ใดติดไวรัส หมายถึงว่าไวรัสได้เข้าไปฝังตัวอยู่ในหน่วยความจำคอมพิวเตอร์เรียบร้อยแล้ว เนื่องจากไวรัสก็เป็นแค่โปรแกรมๆ หนึ่ง การที่ไวรัสจะเข้าไปอยู่ในหน่วยความจำได้นั้นจะต้องมีการถูกเรียกให้ทำงาน ได้นั้น ยังขึ้นอยู่กับประเภทของไวรัสแต่ละตัว ปกติผู้ใช้มักจะไม่รู้ัตัวว่าได้ทำการปลุกคอมพิวเตอร์ไวรัสขึ้นมาทำงาน แ้้ล้ว
จุดประสงค์ของการทำงานของไวรัสแต่ละตัวขึ้นอยู่กับตัวผู้เขียนโปรแกรมไวรัส นั้น เช่น อาจสร้างไวรัสให้ไปทำลายโปรแกรมหรือข้อมูลอื่นๆ ที่อยู่ในเครื่องคอมพิวเตอร์ หรือแสดงข้อความวิ่งไปมาบนหน้าจอ เป็นต้น
ประเภทของไวรัส

บูตเซกเตอร์ไวรัส

Boot Sector Viruses หรือ Boot Infector Viruses คือ ไวรัสที่เก็บตัวเองอยู่ในบูตเซกเตอร์ของดิสก์ การ ใช้งานของบูตเซกเตอร์คือเมื่อเครื่องคอมพิวเตอร์เริ่มทำงานขึ้นมาตอนแรก เครื่องจะเข้าไปอ่านบูตเซกเตอร์โดยในบูตเซกเตอร์จะมีโปรแกรมเล็กๆไว้ใช้ใน การเรียกระบบปฏิบัติการขึ้นมาทำงานอีกทีหนึ่ง บูตเซกเตอร์ไวรัสจะเข้าไปแทนที่โปรแกรมดังกล่าว และไวรัสประเภทนี้ ถ้าไปติดอยู่ในฮาร์ดดิสก์ โดยทั่วไปจะเข้าไปอยู่บริเวณที่เรียกว่า Master Boot Sector หรือ Parition Table ของฮาร์ดดิสก์นั้น ถ้าบูตเซกเตอร์ของฮาร์ดดิสก์ใดมีไวรัสประเภทนี้ติดอยู่ ทุกๆ ครั้งที่บูตเครื่องขึ้นมาโดย พยายามเรียกดอสจากดิสก์นี้ ตัวโปรแกรมไวรัสจะทำงานก่อนและจะเข้าไปฝังตัวอยู่ในหน่วยความจำเพื่อเตรียม พร้อมที่จะทำงานตามที่ได้ถูกโปรแกรมมา แล้วตัวไวรัสจึงค่อยไปเรียกดอสให้ขึ้นมาทำงานต่อไป ทำให้เหมือนไม่มีอะไรเกิดขึ้น

โปรแกรมไวรัส

Program Viruses หรือ File Intector Viruses เป็นไวรัสอีกประเภทหนึ่งที่จะติดอยู่กับโปรแกรม ซึ่งปกติก็คือ ไฟล์ที่มีนามสกุลเป็น COM หรือ EXE และบางไวรัสสามารถเข้าไปติดอยู่ในโปรแกรมที่มีนามสกุลเป็น sys และโปรแกรมประเภท Overlay Programs ได้ด้วย โปรแกรมโอเวอร์เลย์ปกติจะเป็นไฟล์ีที่มีนามสกุลที่ขึ้นต้นด้วย OV วิธีการที่ไวรัสใช้เพื่อที่จะเข้าไปติดโปรแกรมมีอยู่ 2 วิธี คือ การแทรกตัวเข้าไปอยู่ในโปรแกรม ผลก็คือ หลังจากที่โปรแกรมนั้นติดไวรัสไปแล้ว ขนาดของโปรแกรมจะใหญ่ขึ้น หรืออาจมีการสำเนาตัวเองเข้าไปทับส่วนของโปรแกรมที่มีอยู่เดิม ดังนั้นขนาดของโปรแกรมจะไม่เปลี่ยนและยากที่จะซ่อมให้กลับเป็นดังเดิม การทำงานของไวรัสโดยทั่วไป คือ เมื่อมีการเรียกโปรแกรมที่ติดไวรัสอยู่ ตัวไวรัสจะเ้ข้าไปหาโปรแกรมตัวอื่นๆ ที่อยู่ในดิสก์เพื่อทำสำเนาตัวเองลงไปทันทีแล้วจึงค่อยให้โปรแกรมที่ถูก เรียกนั้น ทำงานตามปกติต่อไป

ม้าโทรจัน

ม้า โทรจัน (Trojan Horse) เป็นโปรแกรมที่ถูกเขียนขึ้นมาใ้ห้ทำตัวเหมือนว่าเป็นโปรแกรมธรรมดาทั่วๆ ไป เพื่อหลอกล่อผู้ใช้ให้ทำการเรียกขึ้นมาทำงาน แต่เมื่อถูกเรียกขึ้นมาแล้ว ก็จะเริ่มทำลายตามที่โปรแกรมมาทันที ม้าโทรจันบางตัวถูกเขียนขึ้นมาใหม่ทั้งชุด โดยคนเขียนจะทำการตั้งชื่อโปรแกรมพร้อมชื่อรุ่นและคำอธิบายการใช้งานที่ดูสม จริง เพื่อหลอกให้คนที่จะเรียกใช้ตายใจ จุดประสงค์ของคนเขียนม้าโทรจันอาจจะเช่นเดียวกับคนเขียนไวรัส คือ เข้าไปทำอันตรายต่อข้อมูลที่มีอยู่ในเครื่อง หรืออาจมีจุดประสงค์เพื่อที่จะล้วงเอาความลับของระบบคอมพิวเตอร์

ม้าโทรจันนี้อาจจะถือว่าไม่ใช่ไวรัส เพราะเป็นโปรแกรมที่ถูกเขียนขึ้นมาโดดๆ และจะไม่มีการเข้าไปติดตั้งในโปรแกรมอื่นเพื่อสำเนาตัวเอง แต่จะใช้ความรู้เท่าไม่ถึงการของผู้ใช้เป็นตัวแพร่ระบาดซอฟต์แวร์ที่มีม้า โทรจันอยู่ในนั้นและนับว่าเป็นหนึ่งในประเภทของโปรแกรมที่มีความอันตรายสูง เพราะยากที่จะตรวจสอบและสร้างขึ้นมาได้ง่าย ซึ่งอาจใช้แค่แบตซ์ไฟล์ก็สามารถโปรแกรมประเภทม้าโทรจันได้

โพลีมอร์ฟิกไวรัส

Polymorphic Viruses เป็นชื่อที่ใช้ในการเรียกไวรัสที่มีความสามารถในการแปรเปลี่ยนตัวเองได้ เมื่อมีการสร้างสำเนาตัวเองเกิดขึ้นซึ่งอาจได้ถึงหลายร้อยรูปแบบ ผลก็คือ ทำให้ไวรัสเหล่านี้ยากต่อการถูกตรวจจับ โดยโปรแกรมตรวจหาไวรัสที่ใช้วิธีการสแกนอย่างเดียว ไวรัสใหม่ๆในปัจจุบันที่มีความสามารถนี้เริ่มมีจำนวนเพิ่มมากขึ้นเรื่อยๆ

สทีลต์ไวรัส

Stealth Viruses เป็นชื่อเรียกไวรัสที่มีความสามารถในการพรางตัวต่อการตรวจจับได้ เช่น ไฟล์อินเฟกเตอร์ ไวรัสประเภทที่ไปติดโปรแกรมใดแล้วจะทำให้ขนาดของโปรแกรมนั้นใหญ่ขึ้น ถ้าโปรแกรมไวรัสนั้นเป็นแบบสทีลต์ไวรัส จะไม่สามารถตรวจดูขนาดที่แท้จริงของโปรแกรมที่เพิ่มขึ้นได้ เนื่องจากตัวไวรัสจะเข้าไปควบคุมดอส เมื่อมีการใช้คำสั่ง DIR หรือโปรแกรมใดก็ตามเพื่อตรวจดูขนาดของโปรแกรม ดอสก็จะแสดงขนาดเหมือนเดิมทุกอย่างราวกับว่าไม่มีอะไรเกิดขึ้น

อาการของเครื่องที่ติดไวรัส

สามารถสังเกตุการทำงานของเครื่องคอมพิวเตอร์ถ้ามีอาการดังต่อไป นี้อาจเป็นไปได้ว่าได้มีไวรัสเ้ข้าไปติดอยู่ในเครื่องแล้ว อาการที่ว่านั้น ได้แก่
  • ใช้เวลานานผิดปกติในการเรียกโปรแกรมขึ้นมาทำงาน
  • ขนาดของโปรแกรมใหญ่ขึ้น
  • วันเวลาของโปรแกรมเปลี่ยนไป
  • ข้อความที่ปกติไม่ค่อยได้เห็นกลับถูกแสดงขึ้นมาบ่อยๆ
  • เกิดอักษรหรือข้อความประหลาดบนหน้าจอ
  • เครื่องส่งเสียงออกทางลำโพงโดยไม่ได้เกิดจากโปรแกรมที่ใช้อยู่
  • แป้นพิมพ์ทำงานผิดปกติหรือไม่ทำงานเลย
  • ขนาดของหน่วยความจำที่เหลือลดน้อยกว่าปกติ โดยหาเหตุผลไม่ได้
  • ไฟล์แสดงสถานะการทำงานของดิสก์ติดค้างนานกว่าที่เคยเป็น
  • ไฟล์ข้อมูลหรือโปรแกรมที่เคยใช้อยู่ๆ ก็หายไป
  • เครื่องทำงานช้าลง
  • เครื่องบูตตัวเองโดยไม่ได้สั่ง
  • ระบบหยุดทำงานโดยไม่ทราบสาเหตุ
  • เซกเตอร์ที่เสียมีจำนวนเพิ่มขึ้นโดยมีการรายงานว่าจำนวนเซกเตอร์ที่เสียมีจำนวนเพิ่มขึ้นกว่าแต่ก่อนโดยที่
  • ยังไม่ได้ใช้โปรแกรมใดเข้าไปตรวจหาเลย
การตรวจหาไวรัส

การสแกน

โปรแกรม ตรวจหาไวรัสที่ใช้ิวิธีการสแกน (Scanning) เรียกว่า สแกนเนอร์ (Scanner) โดยจะมีการดึงเอาโปรแกรมบางส่วนของตัวไวรัสมาเก็บไว้เป็นฐานข้อมูล ส่วนที่ดึงมานั้นเราเรียกว่า ไวรัสซิกเนเจอร์ (VirusSignature) และเมื่อสแกนเนอร์ถูกเรียกขึ้นมาทำงานก็จะเข้าตรวจหาไวรัสในหน่วยความทรงจำ บูตเซกเตอร์และไฟล์โดยใช้ไวรัสซิกเนเจอร์ที่มีอยู่
ข้อดีของ วิธีการนี้ก็คือ เราสามารถตรวจสอบซอฟต์แวร์ที่มาใหม่ได้ทันทีเลยว่าติดไวรัสหรือไม่ เพื่อป้องกันไม่ให้ไวรัสถูกเรียกขึ้นมาทำงานตั้งแต่เริ่มแรก
แต่วิธีนี้มีจุดอ่อนหลายข้อ คือ

1.
ฐาน ข้อมูลที่เก็บไวรัสซิกเนเจอร์จะต้องทันสมัยอยู่เสมอ และครอบคลุมไวรัสทุกตัวมากที่สุดเท่าที่จะทำได้
2.
เพราะสแกนเนอร์จะไม่สามารถตรวจจับไวรัสที่ยังไม่มีซิกเนเจอร์ของไวรัสนั้นเก็บอยู่ในฐานข้อมูลได้
3.
ยากที่จะตรวจจับไวรัสประเภทโพลีมอร์ฟิก เนื่องจากไวรัสประเภทนี้เปลี่ยนแปลงตัวเองได้
4.
จึงทำให้ไวรัสซิกเนเจอร์ที่ใช้สามารถนำมาตรวจสอบได้ก่อนที่ไวรัสจะ้เปลี่ยนตัวเองเท่านั้น
5.
ถ้า มีไวรัสประเภทสทีลต์ไวรัส ติดอยู่ในเครื่องตัวสแกนเนอร์อาจจะไม่สามารถตรวจหาไวรัสนี้ได้
6.
ทั้งนี้ขึ้นอยู่กับความฉลาดและเทคนิคที่ใช้ของตัวไวรัสและของตัวสแกนเนอร์เองว่าใครเก่งกว่า
7.
เนื่อง จากไวรัสมีตัวใหม่ๆ ออกมาอยู่เสมอๆ ผู้ใช้จึงจำเป็นต้องหาสแกนเนอร์ตัวที่ใหม่ที่สุดมาใช้
8.
มีไวรัสบางตัวจะเข้าไปติดในโปรแกรมทันทีที่โปรแกรมนั้นถูกอ่าน และถ้าสมมติ
9.
ว่าสแกนเนอร์ที่ใช้ไม่สามารถตรวจจับได้ และถ้าเครื่องมีไวรัสนี้ติดอยู่ เมื่อมีการ
10.
เรียก สแกนเนอร์ขึ้นมาทำงาน สแกนเนอร์จะเข้าไปอ่านโปรแกรมทีละโปรแกรมเพื่อตรวจสอบ
11.
ผลก็คือจะทำให้ไวรัสตัวนี้เข้าไปติดอยู่ในโปรแกรมทุกตัวที่ถูกสแกนเนอร์นั้นอ่านได้
12.
สแกนเนอร์รายงานผิดพลาดได้ คือ ไวรัสซิกเนเจอร์ที่ใช้บังเอิญไปตรงกับที่มี
13.
อยู่ ในโปรแกรมธรรมดาที่ไม่ได้ติดไวรัส ซึ่งมักจะเกิดขึ้นในกรณีที่ไวรัสซิกเนเจอร์ที่ใช้มีขนาดสั้นไป
14.
จะทำให้โปรแกรมดังกล่าวใช้งานไม่ได้อีกต่อไป

การตรวจการเปลี่ยนแปลง
การ ตรวจการเปลี่ยนแปลง คือ การหาค่าพิเศษอย่างหนึ่งที่เรียกว่า เช็คซัม (Checksum) ซึ่งเกิดจากการนำเอาชุดคำสั่งและข้อมูลที่อยู่ในโปรแกรมมาคำนวณ หรืออาจใช้ข้อมูลอื่นๆ ของไฟล์ ได้แก่ แอตริบิวต์ วันและเวลา เข้ามารวมในการคำนวณด้วย เนื่องจากทุกสิ่งทุกอย่าง ไม่ว่าจะเป็นคำสั่งหรือข้อมูลที่อยู่ในโปรแกรม จะถูกแทนด้วยรหัสเลขฐานสอง เราจึงสามารถนำเอาตัวเลขเหล่านี้มาผ่านขั้นตอนการคำนวณทางคณิตศาสตร์ได้ ซึ่งวิธีการคำนวณเพื่อหาค่าเช็คซัมนี้มีหลายแบบ และมีระดับการตรวจสอบแตกต่างกันออกไป เมื่อตัวโปรแกรมภายในเกิดการเปลี่ยนแปลง ไม่ว่าไวรัสนั้นจะใช้วิธีการแทรกหรือเขียนทับก็ตาม เลขที่ได้จากการคำนวณครั้งใหมจะเปลี่ยนไปจากที่คำนวณได้ก่อนหน้านี้

ข้อดีของ การตรวจการเปลี่ยนแปลงก็คือ สามารถตรวจจับไวรัสใหม่ๆ ได้ และยังมีความสามารถในการตรวจจับไวรัสประเภทโพลีมอร์ฟิกไวรัสได้อีกด้วย แต่ก็ยังยากสำหรับสทีลต์ไวรัส ทั้งนี้ขึ้นอยู่กับความฉลาดของโปรแกรมตรวจหาไวรัสเองด้วยว่า จะสามารถถูกหลอกโดยไวรัสประเภทนี้ได้หรือไม่ และมีวิธีการตรวจการเปลี่ยนแปลงนี้จะตรวจจับไวรัสได้ก็ต่อเมื่อไวรัสได้เข้า ไปติดอยู่ในเครื่องแล้วเท่านั้น และค่อนข้างเสี่ยงในกรณีที่เริ่มมีการคำนวณหาค่าเช็คซัมเป็นครั้งแรก เครื่องที่ใช้ต้องแน่ใจว่าบริสุทธิ์พอ คือต้องไม่มีโปรแกรมใดๆ ติดไวรัส มิฉะนั้นค่าที่หาได้จากการคำนวณที่รวมตัวไวรัสเข้าไปด้วย ซึ่งจะลำบากภายหลังในการที่จะตรวจหาไวรัสตัวนี้ต่อไป

การเฝ้าดู

เพื่อที่จะให้โปรแกรมตรวจจับไวรัสสามารถเฝ้าดูการทำงานของเครื่องได้ตลอด เวลานั้น จึงได้มีโปรแกรม ตรวจจับไวรัสที่ถูกสร้างขึ้นมาเป็นโปรแกรมแบบเรซิเดนท์หรือ ดีไวซ์ไดรเวอร์ โดยเทคนิคของการเฝ้าดูนั้นอาจใช้วิธีการสแกนหรือตรวจการเปลี่ยนแปลง หรือสองแบบรวมกันก็ได้ การทำงานโดยทั่วไป ก็คือ เมื่อซอฟแวร์ตรวจจับไวรัสที่ใช้วิธีนี้ถูกเรียกขึ้นมาทำงานก็จะเข้าไปตรวจใน หน่วยความจำของเครื่องก่อนว่ามีไวรัสติดอยู่หรือไม่โดยใช้ไวรัสซิกเนเจอร์ ที่มีอยู่ในฐานข้อมูล จากนั้นจึงค่อยนำตัวเองเข้าไปฝังอยู่ในหน่วยความจำ และต่อไปถ้ามีการเรียกโปรแกรมใดขึ้นมาใช้งาน โปรแกรมเฝ้าดูนี้ก็จะเข้าไปตรวจโปรแกรมนั้นก่อนโดยใช้เทคนิคการสแกนหรือตรวจ การเปลี่ยนแปลงเพื่อหาไวรัส ถ้าไม่มีปัญหาก็จะอนุญาตให้โปรแกรมนั้นขึ้นมาทำงานได้ นอกจากนี้โปรแกรมตรวจจับไวรัสบางตัวยังสามารถตรวจสอบขณะที่มีการคัดลอกไฟล์ ได้อีกด้วย
ข้อดีของ วิธีนี้ คือ เมื่อมีการเรียกโปรแกรมใดขึ้นมา โปรแกรมนั้นจะถูกตรวจสอบก่อนทุกครั้งโดยอัตโนมัติ ซึ่งถ้าเป็นการใช้สแกนเนอร์จะสามารถทราบได้ว่าโปรแกรมใดติดไวรัสอยู่ ก็ต่อ เมื่อทำการเรียกสแกนเนอร์นั้นขึ้นมาทำงานก่อนเท่านั้น
ข้อเสียของ โปรแกรมตรวจจับไวรัสแบบเฝ้าดูก็คือ จะมีเวลาที่เสียไปสำหรับการตรวจหาไวรัสก่อนทุกครั้ง และเนื่องจากเป็นโปรแกรมแบบเรซิเดนท์หรือดีไวซ์ไดรเวอร์ จึงจำเป็นจะต้องใช้หน่วยความจำส่วนหนึ่งของเครื่องตลอดเวลาเพื่อทำงาน ทำให้หน่วยความจำในเครื่องเหลือน้อยลง และเช่นเดียวกับสแกนเนอร์ ก็คือ จำเป็นจะต้องมีการปรับปรุงฐานข้อมูลของไวรัสซิกเนเจอร์ให้ทันสมัยอยู่เสมอ

คำแนะนำและการป้องกันไวรัส
  • สำรองไฟล์ข้อมูลที่สำคัญ
  • สำหรับเครื่องที่มีฮาร์ดดิสก์ อย่าเรียกดอสจากฟลอปปีดิสก์
  • ป้องกันการเขียนให้กับฟลอปปีดิสก์
  • อย่าเรียกโปรแกรมที่ติดมากับดิสก์อื่น
  • เสาะหาโปรแกรมตรวจหาไวรัสที่ใหม่และมากกว่าหนึ่งโปรแกรมจากคนละบริษัท
  • เรียกใช้โปรแกรมตรวจหาไวรัสเป็นช่วงๆ
  • เรียกใช้โปรแกรมตรวจจับไวรัสแบบเฝ้าดูทุกครั้ง
  • เลือกคัดลอกซอฟแวร์เฉพาะที่ถูกตรวจสอบแล้วในบีบีเอส
  • สำรองข้อมูลที่สำคัญของฮาร์ดิสก์ไปเก็บในฟลอปปีดิสก์
  • เตรียมฟลอปปีดิสก์ที่ไว้สำหรับให้เรียกดอสก์ขึ้นมาทำงานได้
  • เืมื่อเครื่องติดไวรัส ให้พยายามหาที่มาของไวรัสนั้น

การกำจัดไวรัส

เมื่อแน่ใจว่าเครื่องติดไวรัสแล้ว ให้ทำการแก้ไขด้วยความใคร่ครวญและระมัดระวังอย่างมาก เพราะบางครั้งตัวคนแก้เองจะเป็นตัวทำลายมากกว่าตัวไวรัสจริงๆ เสียอีก การฟอร์แมตฮาร์ดดิสก์ใหม่อีกครั้งก็ไม่ใช่วิธีที่ดีที่สุดเสมอไป ยิ่งแย่ไปกว่านั้นถ้าทำไปโดยยังไม่ได้มีการสำรองข้อมูลขึ้นมาก่อน การแก้ไขนั้นถ้าผู้ใช้มีความรู้เกี่ยวกับไวรัสที่กำลังติดอยู่ว่าเป็นประเภท ใดก็จะช่วยได้อย่างมาก และข้อเสนอแนะต่อไปนี้อาจจะมีประโยชน์ต่อท่าน

บูตเครื่องใหม่ทันทีที่ทราบว่าเครื่องติดไวรัส
เมื่อทราบว่าเครื่องติดไวรัสให้ทำการบูตเครื่องใหม่ทันที โดยเรียกดอสขึ้นมาทำงานจากฟลอปปีดิสก์ที่ได้เตรียมไว้ เพราะถ้าไปเรียกดอสจากฮาร์ดดิสก์ เป็นไปได้ว่าตัวไวรัสอาจกลับเข้าไปในหน่วยความจำได้อีก เมื่อเสร็จขั้นตอนการเรียกดอสแล้ว ห้ามเรียกโปรแกรมใดๆ ก็ตามในดิสก์ที่ติดไวรัส เพราะไม่ทราบว่าโปรแกรมใดบ้างที่มีไวรัสติดอยู่

เรียกโปรแกรมไวรัสขึ้นมาตรวจหาและทำลาย

ให้ เรียกโปรแกรมตรวจจับไวรัส เพื่อตรวจสอบดูว่ามีโปรแกรมใดบ้างติดไวรัส ถ้าโปรแกรมตรวจหาไวรัสที่ใช้อยู่สามารถกำจัดไวรัสตัวที่พบได้ก็ให้ลองทำดู แต่ก่อนหน้านี้ให้ทำการคัดลอกเพื่อสำรองโปรแกรมาที่ติดไวรัสไปเสียก่อน โดยโปรแกรมจัดการไวรัสบางโปรแกรมสามารถสั่งให้ทำสำรองโปรแกรมที่ติดไวรัสไป เป็นอีกชื่อหนึ่งก่อนที่จะกำจัดไวรัส เช่น MSAV ของดอสเอง เป็นต้น
การ ทำสำรองก็เพราะว่า เมื่อไวรัสถูกกำจัดออกจากโปรแกรมไป โปรแกรมนั้นอาจไม่สามารถทำงานได้ตามปกติหรือทำงานไม่ได้เลยก็เป็นไปได้ วิธีการตรวจขั้นต้น คือ ให้ลองเปรียบเทียบขนาดของโปรแกรมหลังจากที่ถูกกำจัดไวรัสไปแล้วกับขนาดเดิม ถ้ามีขนาดน้อยกว่าแสดงว่าไม่สำเร็จ หากเป็นเช่นนั้นให้เอาโปรแกรมที่ติดไวรัสที่สำรองไว้ แล้วหาโปรแกรมจัดการไวรัสตัวอื่นมาใช้แทน แต่ถ้ามีขนาดมากกว่าหรือเท่ากับของเดิม เป็นไปได้ว่าการกำจัดไวรัสอาจสำเร็จ โดยอาจลองเรียกโปรแกรมตรวจหาไวรัสเพื่อทดสอบโปรแกรมอีกครั้ง
หาก ผลการตรวจสอบออกมาว่าปลอดเชื้อ ก็ให้ลองเรียกโปรแกรมที่ถูกกำจัดไวรัสไปนั้นขึ้นมาทดสอบการทำงานดูอย่าง ละเอียดว่าเป็นปกติดีอยู่หรือไม่อีกครั้ง ในช่วงดังกล่าวควรเก็บโปรแกรมนี้ที่สำรองไปขณะที่ติดไวรัสอยู่ไว้ เผื่อว่าภายหลังพบว่าโปรแกรมทำงานไม่เป็นไปตามปกติ ก็สามารถลองเรียกโปรแกรมจัดการไวรัสตัวอื่นขึ้นมากำจัดต่อไปในภายหลัง แต่ถ้าแน่ใจว่าโปรแกรมทำงานเป็นปกติดี ก็ทำการลบโปรแกรมสำรองที่ยังติดไวรัสอยู่ทิ้งไปทันที เป็นการป้องกันไม่ให้มีการเรียกขึ้นมาใช้งานภายหลังเพราะความบังเอิญได้



































หาก ผลการตรวจสอบออกมาว่าปลอดเชื้อ ก็ให้ลองเรียกโปรแกรมที่ถูกกำจัดไวรัสไปนั้นขึ้นมาทดสอบการทำงานดูอย่าง ละเอียดว่าเป็นปกติดีอยู่หรือไม่อีกครั้ง ในช่วงดังกล่าวควรเก็บโปรแกรมนี้ที่สำรองไปขณะที่ติดไวรัสอยู่ไว้ เผื่อว่าภายหลังพบว่าโปรแกรมทำงานไม่เป็นไปตามปกติ ก็สามารถลองเรียกโปรแกรมจัดการไวรัสตัวอื่นขึ้นมากำจัดต่อไปในภายหลัง แต่ถ้าแน่ใจว่าโปรแกรมทำงานเป็นปกติดี ก็ทำการลบโปรแกรมสำรองที่ยังติดไวรัสอยู่ทิ้งไปทันที เป็นการป้องกันไม่ให้มีการเรียกขึ้นมาใช้งานภายหลังเพราะความบังเอิญได้