Quick Start =========== MaddogTCP consists of a number of separate utilities. These can be plugged together as needed along with third party utilities. This section shows some examples of how to use MaddogTCP. For detailed descriptions of each command use the sections following "Utility Chains". Let's first look at the most simplistic use, where data is read from a file and sent to the local machine on port 80. Hello.txt just contains the words "Hello world". proc.exe hello.txt | send.exe localhost 80 The following output is displayed to show success: send.exe: Connected to server Of course this isn't very useful because the HTTP server doesn't understand what we've sent. Now let's examine hello.txt more closely. Current it contains: Hello World Suppose we want to send Hello World to the server and receive the response? For this we can use the command token `r`. Let's change our file to: Hello World `r` At this point the file should be renamed hello.fuz, as it represents more than just plain text. The carriage returns are important so the HTTP server knows that it has a command to process. If we run the same command now we see: send.exe: Connected to server S] Hello World R] HTTP/1.1 400 Bad Request R] ... Following the HTTP error you will also see some HTML for rendering the error in a web browser. The `r` command is more powerful than being able to receive data once. For a more complicated protocol like SMTP it can be used to sychronise an SMTP conversation. For instance to initiate an SMTP conversation the following lines could be used (saved into a file called smtp.fuz): `r`HELO paulmdx@paulmdx.plus.com `r`MAIL FROM: <paulmdx@paulmdx.plus.com> `r`RCPT TO: <paulmdx@paulmdx.plus.com> `r`DATA The first `r` receives the server welcome message, and subsequent `r` commands receive the confirmation of what we've sent. After DATA we would then send the email. Using the proc.exe utility to read data and send.exe to send it to the server and receive a response is the fundamental functionality of the MaddogTCP suite. All further utilities are designed to extend its functionality. Supplementary utilities are listed below with a brief example of their use. Utility Chains ============== You will see the use of the pipe token | quite frequently with Maddog, which takes its design influence from unix tools. This design uses stdout (data usually destined for screen using printf) and stdin (data usually read from the keyboard) to pipeline commands together. Proc.exe ======== Usage: proc.exe templatefile.fuz Proc will most likely be the first utility in the chain. Proc accepts a template .fuz file, which is essentially a TCP conversation from the client's perspective. This file contains all information you want to send to the server along with some inline commands that can be used to control Maddog's utilities. Proc processes the file and sends the results to stdout. This output can then either be viewed in a cmd box (in the case of debugging) or piped into further utilities using the | token. Example usage: proc.exe sendsmtp.fuz Corrupt.exe =========== Usage: corrupt.exe [seed] [Nth corruption] Corrupt reads data from stdin (keyboard input, or more usefully piped to it from another utility) and corrupts certain characters. Passing a seed allows you to run multiple commands simultaneously with different randomisation. Nth corruption is the average frequency of corruptions. For instance providing 50 means there will be a corruption every 50th character on average. With default input Corrupt will not perform any corruption. The user must wrap any sections of data with `startcorrupt` and `endcorrupt` in order for Corrupt to perform corruption. These commands can typically be typed into the .fuz file using a text editor. Example Usage: proc.exe sendsmtp.fuz | corrupt 15351 50 Send.exe ======== Usage: send.exe hostname port Send reads data from stdin (keyboard input, or more usefully piped to it from another utility), opens a TCP connection to the host that is specified, and sends the data it has read, taking note of any commands within the stream (wrapped single open quotes `). As most TCP conversations are two-way and often require timing, Send supports the command `r`. This command tells Send to wait to receive some data from the server. Once received it will then resume sending any data it still has. The following start fragment of a .fuz file shows how an SMTP conversation would begin: `r`HELO <fromuser@fromhost.com> `r`MAIL FROM: <fromuser@fromhost.com> `r`RCPT TO: <touser@tohost.com> `r`DATA `r` Note an `r` is the very first item in the .fuz file because upon connect an SMTP server will send a welcome message. To keep the send and recv conversation in sync it must be received before attempting to send an email. Following the above the SMTP email would be sent, then a \r\n.\r\n to indicate the email data had ended. Example usage: proc.exe sendsmtp.fuz | corrupt 15351 50 | send localhost 25