Get raw text for this example (you can click any command below to see its doc)
/* Monitor the status of network objects by sending packets (ICMP-echo, TCP syn or arp request) and recieving response packets. A request may be specified for packet. If any result doesn't match the request then signal will raise and report will be displayed with the list of discrepancies. run: anettest -d eth0 -f this_file.fws */// creating necessary variablesVAR(status, num, 0) VARPARAMETERS: <name of variable> <name of field> <initial value> ("autoset"| ["static"] )Command creates the new variable <name of variable> or reinitializes the old one if some variable of the same name is already exist. The newly created variable will have the same value's type as <name of field>. This command also sets the <initial value> for variable. Variable's value is stored separately from packet's buffer. The "autoset" type of variable indicates that the variable will be initialized by recieved packet (while using WAIT command or its analogs), i.e. from recieved packet will be obtained value of <name of field> and copied to variable. "static" type indicates that variable must not be changed while recieving packet. The "static" keyword may be ommited only if parameters to command are enclosed in round brackets.The <name of variable> may appear amoung parameters to other commands. In this case it will be replaced by its value. Such a replacement will be also performed in strings enclosed in apostrophes. In this case the <name of variable> must be enclosed in $ (ex: 'value of variable = $name$').See "samples/ask_mac.fws", "samples/variables.fws".(count, num, 0) DEFINEPARAMETERS: <name of variable> <name of field> <initial value> ("autoset"| ["static"] )Command creates the new variable <name of variable> or reinitializes the old one if some variable of the same name is already exist. The newly created variable will have the same value's type as <name of field>. This command also sets the <initial value> for variable. Variable's value is stored separately from packet's buffer. The "autoset" type of variable indicates that the variable will be initialized by recieved packet (while using WAIT command or its analogs), i.e. from recieved packet will be obtained value of <name of field> and copied to variable. "static" type indicates that variable must not be changed while recieving packet. The "static" keyword may be ommited only if parameters to command are enclosed in round brackets.The <name of variable> may appear amoung parameters to other commands. In this case it will be replaced by its value. Such a replacement will be also performed in strings enclosed in apostrophes. In this case the <name of variable> must be enclosed in $ (ex: 'value of variable = $name$').See "samples/ask_mac.fws", "samples/variables.fws".PARAMETERS: <name> <value>Defines the substitution which will be applied while reading some values (in parameters to commands and others). <name> will be replaced by <value>. This substitution may be also performed in strings enclosed in apostrophes. In this case the <name> must be enclosed in $ (ex: 'value = $name$'. See also command GDEF.PARAMETERS: <new name> <original name>Defines the substitution which will be applied while reading almost any read word from text. <New name> will be replaced by <original name>. This substitution may be also performed in strings enclosed in apostrophes. In this case the name must be enclosed in $ (ex: 'value = $name$'.host1, 1.1.1.1 DEFINEPARAMETERS: <name> <value>Defines the substitution which will be applied while reading some values (in parameters to commands and others). <name> will be replaced by <value>. This substitution may be also performed in strings enclosed in apostrophes. In this case the <name> must be enclosed in $ (ex: 'value = $name$'. See also command GDEF.PARAMETERS: <new name> <original name>Defines the substitution which will be applied while reading almost any read word from text. <New name> will be replaced by <original name>. This substitution may be also performed in strings enclosed in apostrophes. In this case the name must be enclosed in $ (ex: 'value = $name$'.PARAMETERS: <name> <value>Defines the substitution which will be applied while reading some values (in parameters to commands and others). <name> will be replaced by <value>. This substitution may be also performed in strings enclosed in apostrophes. In this case the <name> must be enclosed in $ (ex: 'value = $name$'. See also command GDEF.PARAMETERS: <new name> <original name>Defines the substitution which will be applied while reading almost any read word from text. <New name> will be replaced by <original name>. This substitution may be also performed in strings enclosed in apostrophes. In this case the name must be enclosed in $ (ex: 'value = $name$'.host2, 2.2.2.2 DEFINEPARAMETERS: <name> <value>Defines the substitution which will be applied while reading some values (in parameters to commands and others). <name> will be replaced by <value>. This substitution may be also performed in strings enclosed in apostrophes. In this case the <name> must be enclosed in $ (ex: 'value = $name$'. See also command GDEF.PARAMETERS: <new name> <original name>Defines the substitution which will be applied while reading almost any read word from text. <New name> will be replaced by <original name>. This substitution may be also performed in strings enclosed in apostrophes. In this case the name must be enclosed in $ (ex: 'value = $name$'.PARAMETERS: <name> <value>Defines the substitution which will be applied while reading some values (in parameters to commands and others). <name> will be replaced by <value>. This substitution may be also performed in strings enclosed in apostrophes. In this case the <name> must be enclosed in $ (ex: 'value = $name$'. See also command GDEF.PARAMETERS: <new name> <original name>Defines the substitution which will be applied while reading almost any read word from text. <New name> will be replaced by <original name>. This substitution may be also performed in strings enclosed in apostrophes. In this case the name must be enclosed in $ (ex: 'value = $name$'.gatewayIP, 10.179.0.1 DEFINEPARAMETERS: <name> <value>Defines the substitution which will be applied while reading some values (in parameters to commands and others). <name> will be replaced by <value>. This substitution may be also performed in strings enclosed in apostrophes. In this case the <name> must be enclosed in $ (ex: 'value = $name$'. See also command GDEF.PARAMETERS: <new name> <original name>Defines the substitution which will be applied while reading almost any read word from text. <New name> will be replaced by <original name>. This substitution may be also performed in strings enclosed in apostrophes. In this case the name must be enclosed in $ (ex: 'value = $name$'.PARAMETERS: <name> <value>Defines the substitution which will be applied while reading some values (in parameters to commands and others). <name> will be replaced by <value>. This substitution may be also performed in strings enclosed in apostrophes. In this case the <name> must be enclosed in $ (ex: 'value = $name$'. See also command GDEF.PARAMETERS: <new name> <original name>Defines the substitution which will be applied while reading almost any read word from text. <New name> will be replaced by <original name>. This substitution may be also performed in strings enclosed in apostrophes. In this case the name must be enclosed in $ (ex: 'value = $name$'.myip, 10.179.88.9 DEFINEPARAMETERS: <name> <value>Defines the substitution which will be applied while reading some values (in parameters to commands and others). <name> will be replaced by <value>. This substitution may be also performed in strings enclosed in apostrophes. In this case the <name> must be enclosed in $ (ex: 'value = $name$'. See also command GDEF.PARAMETERS: <new name> <original name>Defines the substitution which will be applied while reading almost any read word from text. <New name> will be replaced by <original name>. This substitution may be also performed in strings enclosed in apostrophes. In this case the name must be enclosed in $ (ex: 'value = $name$'.PARAMETERS: <name> <value>Defines the substitution which will be applied while reading some values (in parameters to commands and others). <name> will be replaced by <value>. This substitution may be also performed in strings enclosed in apostrophes. In this case the <name> must be enclosed in $ (ex: 'value = $name$'. See also command GDEF.PARAMETERS: <new name> <original name>Defines the substitution which will be applied while reading almost any read word from text. <New name> will be replaced by <original name>. This substitution may be also performed in strings enclosed in apostrophes. In this case the name must be enclosed in $ (ex: 'value = $name$'.gatewayMac, 00:1d:a1:73:b3:c0PARAMETERS: <name> <value>Defines the substitution which will be applied while reading some values (in parameters to commands and others). <name> will be replaced by <value>. This substitution may be also performed in strings enclosed in apostrophes. In this case the <name> must be enclosed in $ (ex: 'value = $name$'. See also command GDEF.PARAMETERS: <new name> <original name>Defines the substitution which will be applied while reading almost any read word from text. <New name> will be replaced by <original name>. This substitution may be also performed in strings enclosed in apostrophes. In this case the name must be enclosed in $ (ex: 'value = $name$'.// defines the address of gateway in local networkDEFINEPARAMETERS: <name> <value>Defines the substitution which will be applied while reading some values (in parameters to commands and others). <name> will be replaced by <value>. This substitution may be also performed in strings enclosed in apostrophes. In this case the <name> must be enclosed in $ (ex: 'value = $name$'. See also command GDEF.PARAMETERS: <new name> <original name>Defines the substitution which will be applied while reading almost any read word from text. <New name> will be replaced by <original name>. This substitution may be also performed in strings enclosed in apostrophes. In this case the name must be enclosed in $ (ex: 'value = $name$'.myMac, 00:1b:38:4f:06:29PARAMETERS: <name> <value>Defines the substitution which will be applied while reading some values (in parameters to commands and others). <name> will be replaced by <value>. This substitution may be also performed in strings enclosed in apostrophes. In this case the <name> must be enclosed in $ (ex: 'value = $name$'. See also command GDEF.PARAMETERS: <new name> <original name>Defines the substitution which will be applied while reading almost any read word from text. <New name> will be replaced by <original name>. This substitution may be also performed in strings enclosed in apostrophes. In this case the name must be enclosed in $ (ex: 'value = $name$'.// defines the address of this host// more reasonable to make this definitions in fileQUIET"base.fws"TIMEOUTPARAMETERS: no parametersInstructs to not display some annoying messages.PARAMETERS: <initval in milliseconds>Defines the timeout for WAIT command (and its analogs), also for imitation of application's work. Null value means infinite timeout (such timeout will not be applied for imitation of application's work). In the case of negative value its absolute value will be obtained as timeout, but WAIT command (its analogs) will work differently: it will always wait for the whole timeout (not terminating on first recieved packet). So several packets may be registered as recieved. This command also defines the timeout for TCP server while waiting for connections.= -2000PARAMETERS: <initval in milliseconds>Defines the timeout for WAIT command (and its analogs), also for imitation of application's work. Null value means infinite timeout (such timeout will not be applied for imitation of application's work). In the case of negative value its absolute value will be obtained as timeout, but WAIT command (its analogs) will work differently: it will always wait for the whole timeout (not terminating on first recieved packet). So several packets may be registered as recieved. This command also defines the timeout for TCP server while waiting for connections.// timeout of waiting response packets (2 seconds)DEFAULTSanyPARAMETERS: {accept | drop | any | REVERS}PARAMETERS: not commandRequest specification. May only be given in parameters for DEFAULT command. Instructs to revers the request for every packet.Defines default requests for packets. These requests will be applied when there are not enough explicitly defined requests for some packet (specified as parameters to command SEND, WAITand its analogs). Initially default requests are ACCEPT ANY ANY... i.e. a single request for the first interface specified via option -d.PARAMETERS: {accept | drop | any }Waits for packet whose mask is defined above. The command will finish work when such packet is recieved on waitable interface. The waitable interface is interface for which strict request (accept or drop) have been specified in parameters to command or in defaults (command DEFAULT). For TCP device the command will only wait data on the main interface. In the general case command may wait no one but several packets (added by ADDcommand). If any of them is recieved then command terminates. Command waits packets until timeout expires (command TIMEOUTPARAMETERS:Alias of TOWAIT command.). See "samples/waiting_packets.fws".PARAMETERS: <initval in milliseconds>Defines the timeout for WAIT command (and its analogs), also for imitation of application's work. Null value means infinite timeout (such timeout will not be applied for imitation of application's work). In the case of negative value its absolute value will be obtained as timeout, but WAIT command (its analogs) will work differently: it will always wait for the whole timeout (not terminating on first recieved packet). So several packets may be registered as recieved. This command also defines the timeout for TCP server while waiting for connections.// sets default request - any, i.e. no request by default// below there is an infinite cycle of sending packets and waiting a responseCYCinf {PARAMETERS: <number of iterations>Command instructs that next WAIT command (its analogs) or next block of script will be processed by several times = <number of iterations>. The "inf" value is available which means infinite iterant processing.// ****************************************************************// ****************************************************************// ****************************************************************// the description of packet which will be waited (ICMP echo response)NAMEPARAMETERS: <name of packet>Defines the name of currently described packet which will be displayed in report instead of not obvious "Packet on line ..."PARAMETERS: <name of packet>Defines the name of currently described packet which will be displayed in report instead of not obvious "Packet on line ...""reply from host1"INCLUDEicmpPARAMETERS: <name of file>Starts processing the content of given file. The search of file will be performed in the current directory, all search paths (see option -I). For every path the content of samples, headers, traces folders will be also examined.// forms standart ICMP-echo packetdstip = myip srcip = host1 ORPARAMETERS:Alias of TOWAIT command.PARAMETERS:Alias of TOWAIT command.// registrates the described packet so the sniffer (in separate thread) starts to wait this packet// no request is specified so the default request (any result) will be applied// the description of packet to send (ICMP echo request)srcmac = myMac dstmac = gatewayMac// INCLUDEdstip = host1 srcip = myip SENDme2gwPARAMETERS: <name of file>Starts processing the content of given file. The search of file will be performed in the current directory, all search paths (see option -I). For every path the content of samples, headers, traces folders will be also examined.PARAMETERS: {accept | drop | any }In common regime generates the packet defined above. In other regimes (testing packet filter, see command FASTTESTand option -c) may simply separate packets one from another, so by this command the current content of buffer will be fixed and the new packet will be registered. The requests after command don't make sense in common regime (only while testing packet filter).PARAMETERS: no parametersEnables fasttest regime for packet filter test. See "samples/fasttest".PARAMETERS: {accept | drop | any }In common regime generates the packet defined above. In other regimes (testing packet filter, see command FASTTESTand option -c) may simply separate packets one from another, so by this command the current content of buffer will be fixed and the new packet will be registered. The requests after command don't make sense in common regime (only while testing packet filter).PARAMETERS: no parametersEnables fasttest regime for packet filter test. See "samples/fasttest".// sends above packetWAITALLPARAMETERS: no parametersThe analog of WAIT command. Doesn't add the previously defined packet to the list of waited ones. Starts waiting simply. Packets may be already added by ADDcommand (or using of UNFIX command).PARAMETERS:Alias of TOWAIT command.// waits registered packets (or terminates immediately if packets have already been recieved)// ****************************************************************// ****************************************************************// ****************************************************************// THE NEXT PACKETNAMEPARAMETERS: <name of packet>Defines the name of currently described packet which will be displayed in report instead of not obvious "Packet on line ..."PARAMETERS: <name of packet>Defines the name of currently described packet which will be displayed in report instead of not obvious "Packet on line ...""arp reply from gateway "INCLUDEarp srcmac = gatewayMac dstmac = myMac ORPARAMETERS: <name of file>Starts processing the content of given file. The search of file will be performed in the current directory, all search paths (see option -I). For every path the content of samples, headers, traces folders will be also examined.PARAMETERS:Alias of TOWAIT command.acceptPARAMETERS:Alias of TOWAIT command.// accept request is specified - this packet must be acceptedINCLUDEarp srcmac = myMac dstmac = gatewayMac arp.type = areq arp.srcmac = myMac arp.srcip = myip arp.dstip = gatewayIP SENDPARAMETERS: <name of file>Starts processing the content of given file. The search of file will be performed in the current directory, all search paths (see option -I). For every path the content of samples, headers, traces folders will be also examined.PARAMETERS: {accept | drop | any }In common regime generates the packet defined above. In other regimes (testing packet filter, see command FASTTESTand option -c) may simply separate packets one from another, so by this command the current content of buffer will be fixed and the new packet will be registered. The requests after command don't make sense in common regime (only while testing packet filter).PARAMETERS: no parametersEnables fasttest regime for packet filter test. See "samples/fasttest".WAITALLPARAMETERS: {accept | drop | any }In common regime generates the packet defined above. In other regimes (testing packet filter, see command FASTTESTand option -c) may simply separate packets one from another, so by this command the current content of buffer will be fixed and the new packet will be registered. The requests after command don't make sense in common regime (only while testing packet filter).PARAMETERS: no parametersEnables fasttest regime for packet filter test. See "samples/fasttest".PARAMETERS: no parametersThe analog of WAIT command. Doesn't add the previously defined packet to the list of waited ones. Starts waiting simply. Packets may be already added by ADDcommand (or using of UNFIX command).PARAMETERS:Alias of TOWAIT command.// ****************************************************************// ****************************************************************// ****************************************************************// THE NEXT PACKETNAMEPARAMETERS: <name of packet>Defines the name of currently described packet which will be displayed in report instead of not obvious "Packet on line ..."PARAMETERS: <name of packet>Defines the name of currently described packet which will be displayed in report instead of not obvious "Packet on line ...""tcp from google "INCLUDEtcpstdopt srcip = www.google.com dstip = victim ORPARAMETERS: <name of file>Starts processing the content of given file. The search of file will be performed in the current directory, all search paths (see option -I). For every path the content of samples, headers, traces folders will be also examined.PARAMETERS:Alias of TOWAIT command.dropPARAMETERS:Alias of TOWAIT command.// this packet must not be acceptedINCLUDEtcpstdopt srcport = RANDPARAMETERS: <name of file>Starts processing the content of given file. The search of file will be performed in the current directory, all search paths (see option -I). For every path the content of samples, headers, traces folders will be also examined.srcmac = myMac dstmac = gatewayMac srcip = myip dstport = 80 dstip = www.google.com SENDPARAMETERS: no commandSpecifies the random value for field.PARAMETERS: {accept | drop | any }In common regime generates the packet defined above. In other regimes (testing packet filter, see command FASTTESTand option -c) may simply separate packets one from another, so by this command the current content of buffer will be fixed and the new packet will be registered. The requests after command don't make sense in common regime (only while testing packet filter).PARAMETERS: no parametersEnables fasttest regime for packet filter test. See "samples/fasttest".WAITALLPARAMETERS: {accept | drop | any }In common regime generates the packet defined above. In other regimes (testing packet filter, see command FASTTESTand option -c) may simply separate packets one from another, so by this command the current content of buffer will be fixed and the new packet will be registered. The requests after command don't make sense in common regime (only while testing packet filter).PARAMETERS: no parametersEnables fasttest regime for packet filter test. See "samples/fasttest".PARAMETERS: no parametersThe analog of WAIT command. Doesn't add the previously defined packet to the list of waited ones. Starts waiting simply. Packets may be already added by ADDcommand (or using of UNFIX command).PARAMETERS:Alias of TOWAIT command.// ****************************************************************// ****************************************************************// ****************************************************************SHOWREPPARAMETERS: no parametersDisplays a report which is the same as that displayed while program termination.// displays the report - the list of discrepancies orIF"SUCCESSFULL TEST"PARAMETERS: <value1> <type of compare> <value2> "{" <first block of script> "}" [ "else" "{" <second block of script> "}" ]Processes the first block of script if condition is met, otherwise processes the second block if it is specified. <Types of compare>: = (==), !=, >, <, >=, <=. Hexadecimals number are treated as strings (with 0x prefix). If you have problems try to watch how these values are represented by string using PRINT command for example.LASTRESPARAMETERS: <value1> <type of compare> <value2> "{" <first block of script> "}" [ "else" "{" <second block of script> "}" ]Processes the first block of script if condition is met, otherwise processes the second block if it is specified. <Types of compare>: = (==), !=, >, <, >=, <=. Hexadecimals number are treated as strings (with 0x prefix). If you have problems try to watch how these values are represented by string using PRINT command for example.== 2 {PARAMETERS: no commandThis special value enables to get the last result of statistic analyzing performed by SHOWREP. 0 - successfull, 2 - some discrepancy is found.// test is not successfullstatus += 1// increments the status variable} else {// test is successfullstatus = 0// resets the status variable} IFPARAMETERS: <value1> <type of compare> <value2> "{" <first block of script> "}" [ "else" "{" <second block of script> "}" ]Processes the first block of script if condition is met, otherwise processes the second block if it is specified. <Types of compare>: = (==), !=, >, <, >=, <=. Hexadecimals number are treated as strings (with 0x prefix). If you have problems try to watch how these values are represented by string using PRINT command for example.status >= 3 {PARAMETERS: <value1> <type of compare> <value2> "{" <first block of script> "}" [ "else" "{" <second block of script> "}" ]Processes the first block of script if condition is met, otherwise processes the second block if it is specified. <Types of compare>: = (==), !=, >, <, >=, <=. Hexadecimals number are treated as strings (with 0x prefix). If you have problems try to watch how these values are represented by string using PRINT command for example.// if status variable is too largeBEEPPARAMETERS: no parametersPlays the sound via PC speaker.// plays a sound// PLAYPARAMETERS: <name of wav file>Windows only. Plays the specified sound, WAV-file. Sound system must be enabled. If the file is not found then default Windows sound will be played. If the file is in current folder or in standard system folder then the full path is not required (Media/<name>).Under UNIX the sound will be played by PC speaker."Windows XP Battery Critical.wav"// under Windows plays a wav file, if sound system is enabledPRINTLstatusPARAMETERS: <message>Analog of PRINT command. Additionally performs the line feed.// displays the value of status variable} CLEARREGPARAMETERS: no parametersClears the information about all the packets which were added to the waited ones (by WAIT, ADDcommands). They will not be displayed in final report (or in the report that is displayed by SHOWREPPARAMETERS:Alias of TOWAIT command.command). If this command is typed at the end of script then it omits the displaying of final report (sense there are no packet in it).PARAMETERS: no parametersDisplays a report which is the same as that displayed while program termination.// clears info about all registered packets// pauses executionIFPARAMETERS: <value1> <type of compare> <value2> "{" <first block of script> "}" [ "else" "{" <second block of script> "}" ]Processes the first block of script if condition is met, otherwise processes the second block if it is specified. <Types of compare>: = (==), !=, >, <, >=, <=. Hexadecimals number are treated as strings (with 0x prefix). If you have problems try to watch how these values are represented by string using PRINT command for example.count > 5 { PAUSEPARAMETERS: <value1> <type of compare> <value2> "{" <first block of script> "}" [ "else" "{" <second block of script> "}" ]Processes the first block of script if condition is met, otherwise processes the second block if it is specified. <Types of compare>: = (==), !=, >, <, >=, <=. Hexadecimals number are treated as strings (with 0x prefix). If you have problems try to watch how these values are represented by string using PRINT command for example.3000 } else { PAUSEPARAMETERS: <number of milliseconds>Pauses the execution for a specified interval of time.500 } count += 1 }PARAMETERS: <number of milliseconds>Pauses the execution for a specified interval of time.