:: umit; adding options ::
First of all
The files related to this magic that are worth to note: options.xml, profile_editor.xml and wizard.xml. They should be at umit main dir root. If they're not there, try to find where they were installed.
- options.xml - Every option supported by UMIT interface should be listed here. But that doesn't mean that you can't write by hand a command at UMIT. If nmap can handle that option, go ahead!
- profile_editor.xml - This file specify which options Profile Editor window should display. This file makes reference to existing options at options.xml.
- wizard.xml - Specify options shown at Wizard window. Same as profile_editor.xml: must reference existing options at options.xml.
For this task you don't need to know about programming, but you should know a little bit of xml. If you don't, be careful: one mistake and UMIT could not run properly. Make your best following the file syntax.
Here is a piece of xml at options.xml:
<?xml version="1.0"?> <nmap_options> <option name="FTP bounce attack" option="-b %s" hint="Try to use a given FTP server as proxy" arguments="Host in standard URL notation: username:password@server:port" need_root="0"/> <option name="ACK scan" option="-sA" hint="Try to discover firewall rulesets" arguments="" need_root="1"/> <option name="FIN scan" option="-sF" hint="Stealth FIN scan mode" arguments="" need_root="1"/> </nmap_options>
And here, the piece we should look more carefully:
<option name="FTP bounce attack" option="-b %s" hint="Try to use a given FTP server as proxy" arguments="Host in standard URL notation: username:password@server:port" need_root="0"/>
That's an nmap option! The tag <option> defines a nmap option that can be used by UMIT with the information needed to properly generate and show commands.About the arguments:
- name - The option's nam that will be displayed at the interface wherever it will appear. Should not be so long: 25 chars should be your max limit.
- option - The nmap option. Some options need arguments. These arguments will be provided at UMIT interface, using a combo box, or text entry. To support arguments, you must put '%s' where the argument should appear. For example: the option '-p80' specifies that nmap should look for the port 80 only. To make it work on UMIT, you should write it this way at options.xml: '-p%s'. If the options don't need an argument, just write it there as you should at command line.
- hint - A tip that should appear to user if hanging the mouse over the option.
- arguments - An explanation about the arguments needed by this option. If there is no argument needed, let it blank!
- need_root - Some options need root privileges to run. If the option you're registering need root, put the number 1 here. If not, put 0.
Working example :
<option name="Max Retries" option="--max_retries %s" hint="Limit the maximum number of retransmissions the port scan engine should do" arguments="The number of retransmissions" need_root="0"/>
This is a brand new nmap option. Let's make UMIT display it at it's interface...
As said before, profile_editor.xml is the file that defines Profile Editor window options and organization. This file has a diferent structure when compared to options.xml.
This xml have this structure:
<xml version="1.0"?> <interface> <groups> <group name="Scan"/> </groups> <Scan label='Scan options'> <option_list label="TCP scan: "> <option name="None"/> <option name="ACK scan"/> <option name="FIN scan"/> <option name="Null Scan"/> <option name="TCP SYN Scan"/> <option name="TCP connect Scan"/> <option name="Window Scan"/> <option name="Xmas Tree"/> </option_list> <option_check label="Idle Scan (Zombie)" option="Idle Scan" arg_type="str"/> <option_check label="Scan random hosts" option="Scan random hosts" arg_type="int"/> </Scan> </interface>
This example is not the real file. There is only the main tags that I need to explain. The root tag is 'interface'. This tag needs no argument. So, it's not worth to mention. The tag 'groups' follows, and inside it we define the groups that the Profile Editor window should display. Each 'group' tag define a new tab at Profile Editor. The argument 'name' is used in two distinct situations: at the label of the tab and at the tag that defines it's content in this xml. UMIT's original profile_editor.xml has the group with name 'Scan'. If you look at the UMIT Interface, inside Profile Editor window, you'll see that there is a tab with this name. The content of this tab is defined above, inside the tag 'Scan'.
Defining tab content
Inside a tab we can define which options we want to show and the sequence they will be arranged. UMIT arrange options following the sequence of options at profile_editor.xml. Simple, isn't it?
Each option has it's own behavior. Some of them, works with arguments, others, works only with integer arguments, and some require a path to a file. There is two distinct tags that defines all this behavior: option_list and option_check.
Some options are exclusive. They just can't be used together. In this case, we can create a list of options. At the interface, will appear a drop down list with some options to choose. This way you can only use one per time.
There are option lists at 'TCP Scan', 'Special Scans' and 'Timing'.
To define a option list, follow the sintax above:
<option_list label="TCP scan: "> <option name="None"/> <option name="ACK scan"/> <option name="FIN scan"/> <option name="Null Scan"/> <option name="TCP SYN Scan"/> </option_list>
We create a new option list creating a new 'option_list' tag. The argument 'label' at 'option_list' tag define the label that should appear at the interface. Inside this tag, we define which options should be listed in the drop down menu. The tag that define these options is the 'option' tag and the argument 'name' define which option at options.xml we want to use. No big deal, uh?
Almost every option can be expressed with this tag. Options that require integer, strings and even paths as arguments can be easily defined within this tag.
The main 'option_check' tag arguments are: 'label', that defines the text that will be shown at the option; 'option', with the name of the option at options.xml that we are setting; 'arg_type', defining which kind of argument this option should receive.
Types of options:
- Without arguments - This kind of option don't carry any argument. To create an option like this, you don't need to specify an 'arg_type'. Just define the label and the option at options.xml.
- Alphanumeric arguments - This option require an alphanurical argument, like sequence of port numbers. To set this kind of option, define 'arg_type' as 'str'.
- Numerical arguments - This option require a numerical argument, like the maximum number o retrasmissions (as in the brand new option --max_retries). In this case we can set 'arg_type' as 'int'.
- Option repetition - Some specific options must be repeated to increase it's level. As an example, we have the option '-v' that show more information while scanning. If you want to increase the quantity of information been shown, you need to use '-v -v'. And repeate '-v' as much as you want to increase the verbose level. For this kind of option, put 'level' at 'arg_type'.
- Path - Some arguments ask for a path to save results, or query information. To define this kind of option, just set 'path' to 'arg_type'.
- Network interface - The option require a valid network interface. Setting 'interface' to 'arg_type', you'll have a list of valid interfaces at the machine. Currently, this option is not working well, but you can enter an interface by yourself. Use this option instead of 'str', because it will be supported on next UMIT releases.
Setting a new option on Profile Editor
We saved the option 'Max Retries' at options.xml. Now, we're going to make it appear at Profile Editor window. As we now, this option require a numerical argument, that is the number of retransmitions that the scan engine should do.
Find the tab you wish to add this brand new option, and add this tag:
<option_check label='Maximum Retries' option='Max Retries' arg_type='int'>
Restart UMIT, and see what happened! ;-)
Adding this option to the Wizard
The wizard.xml file has the same sintax explained at profile_editor.xml. So, to add this option to Wizard interface, find the step you want to add the new option, and add the same 'option_check' you added at profile_editor.xml.
Adriano Monteiro Marques
December 30th 2005
Goiania - Brazil