Key Pages: [ Rope Home Page | Basics (tutorial) | Language Reference | Download ]
ROPE string constants are specified using either double or single quotes, like this..
"this is double-quoted string" 'this is a single-quoted string'
When double-quotes are used, the string can contain some "escape sequences" that provide a visual means of specifying non-visual characters. The possibilities are..
In the current version of ROPE, no other escape sequences are handled.
Escape sequences are not expanded in single-quoted strings.
Note: this feature was extended in the 20050418 version of Rope to allow it to be used for strings other than IPv4 Addresses.
Strings can also be specified using a sequence of numbers with dots between them, like this..
104.101.108.108.110
Each number is the ascii value of a character and so must be between 0 and 255. The example above shows the word "hello" as a dotted string.
This syntax is designed primarily for use in specifying IPv4 addresses (see IpAddress), which Rope handles as four-character strings like this..
192.168.0.1
Note that the dotted string syntax can only be used to represent strings of between 2 and 255 characters in length.
Note: this syntax was added in the 20050418 release.
Like the dotted syntax described above, strings can also be specified in hexadecimal with a colon (":") delimiter. Here's the word "hello" again, using this syntax style..
68:65:6c:6c:6f
This is designed for representing ethernet MAC addresses (see MacAddress), like this..
00:0F:1F:5C:30:21
But can be used to represent binary strings in any other context.
The hex string syntax is limited to strings with lengths between 2 and 255 characters. Each character may be represented with either 1 or 2 hex digits in either upper or lower case.
Strings can also be lift-ed from the IP packet being inspected, and therefore may also contain non-ascii characters including the null character (number 0). For this reason, ROPE strings are not null-terminated and can contain any character without problem.
Where ever possible, when ROPE pushes strings onto the stack, it does not duplicate the string data anywhere, but simply returns a reference to the existing string. This works for all string-related actions that return portions of existing strings. This means that functions like "left", "lift", "right" etc return strings that "point to" the same buffer as the string they refer to.
So, if the $data contains the following text at the memory address 0x12300000..
GET /rope/LanguageReference HTTP/1.1
Then the command
substr($data 4 5) $a put
Causes the $a register to point to the address 0x12300000 + 4 (which is 0x12300004), and have a length of 5 bytes. So $a actually points into $data. This is entirely safe since Rope knows that nothing can change the contents of $data, so the value of $a is safe from unexpected changes.
On the other hand; if it is not possible to use this "point into" logic, Rope constructs the new string in a "jotter" buffer associated with the stack. The strcat action is an example of this logic because the new string it returns is not simply a portion of an existing string, but an entirely new one. Currently, there is no "garbage collection" on the jotter except at the start and end of the script execution, therefore a script that makes extensive use of these kinds of actions could eventually fail with a "jotter full" error (so use them sparingly).
All strings returned and manipulated by Rope registers are located either in the packet being inspected, the code of the script itself or the stack "jotter".
Lowth.com: [ Home | Rope | P2PWall | LinWiz | cutter | Protector - Free Antivirus software | TapeIO ]