1 
2 /***************************************************************************
3  * global_structures.h -- Common structure definitions used by Ncrack      *
4  * components.                                                             *
5  *                                                                         *
6  ***********************IMPORTANT NMAP LICENSE TERMS************************
7  *                                                                         *
8  * The Nmap Security Scanner is (C) 1996-2019 Insecure.Com LLC ("The Nmap  *
9  * Project"). Nmap is also a registered trademark of the Nmap Project.     *
10  * This program is free software; you may redistribute and/or modify it    *
11  * under the terms of the GNU General Public License as published by the   *
12  * Free Software Foundation; Version 2 ("GPL"), BUT ONLY WITH ALL OF THE   *
13  * CLARIFICATIONS AND EXCEPTIONS DESCRIBED HEREIN.  This guarantees your   *
14  * right to use, modify, and redistribute this software under certain      *
15  * conditions.  If you wish to embed Nmap technology into proprietary      *
16  * software, we sell alternative licenses (contact sales@nmap.com).        *
17  * Dozens of software vendors already license Nmap technology such as      *
18  * host discovery, port scanning, OS detection, version detection, and     *
19  * the Nmap Scripting Engine.                                              *
20  *                                                                         *
21  * Note that the GPL places important restrictions on "derivative works",  *
22  * yet it does not provide a detailed definition of that term.  To avoid   *
23  * misunderstandings, we interpret that term as broadly as copyright law   *
24  * allows.  For example, we consider an application to constitute a        *
25  * derivative work for the purpose of this license if it does any of the   *
26  * following with any software or content covered by this license          *
27  * ("Covered Software"):                                                   *
28  *                                                                         *
29  * o Integrates source code from Covered Software.                         *
30  *                                                                         *
31  * o Reads or includes copyrighted data files, such as Nmap's nmap-os-db   *
32  * or nmap-service-probes.                                                 *
33  *                                                                         *
34  * o Is designed specifically to execute Covered Software and parse the    *
35  * results (as opposed to typical shell or execution-menu apps, which will *
36  * execute anything you tell them to).                                     *
37  *                                                                         *
38  * o Includes Covered Software in a proprietary executable installer.  The *
39  * installers produced by InstallShield are an example of this.  Including *
40  * Nmap with other software in compressed or archival form does not        *
41  * trigger this provision, provided appropriate open source decompression  *
42  * or de-archiving software is widely available for no charge.  For the    *
43  * purposes of this license, an installer is considered to include Covered *
44  * Software even if it actually retrieves a copy of Covered Software from  *
45  * another source during runtime (such as by downloading it from the       *
46  * Internet).                                                              *
47  *                                                                         *
48  * o Links (statically or dynamically) to a library which does any of the  *
49  * above.                                                                  *
50  *                                                                         *
51  * o Executes a helper program, module, or script to do any of the above.  *
52  *                                                                         *
53  * This list is not exclusive, but is meant to clarify our interpretation  *
54  * of derived works with some common examples.  Other people may interpret *
55  * the plain GPL differently, so we consider this a special exception to   *
56  * the GPL that we apply to Covered Software.  Works which meet any of     *
57  * these conditions must conform to all of the terms of this license,      *
58  * particularly including the GPL Section 3 requirements of providing      *
59  * source code and allowing free redistribution of the work as a whole.    *
60  *                                                                         *
61  * As another special exception to the GPL terms, the Nmap Project grants  *
62  * permission to link the code of this program with any version of the     *
63  * OpenSSL library which is distributed under a license identical to that  *
64  * listed in the included docs/licenses/OpenSSL.txt file, and distribute   *
65  * linked combinations including the two.                                  *
66  *                                                                         *
67  * The Nmap Project has permission to redistribute Npcap, a packet         *
68  * capturing driver and library for the Microsoft Windows platform.        *
69  * Npcap is a separate work with it's own license rather than this Nmap    *
70  * license.  Since the Npcap license does not permit redistribution        *
71  * without special permission, our Nmap Windows binary packages which      *
72  * contain Npcap may not be redistributed without special permission.      *
73  *                                                                         *
74  * Any redistribution of Covered Software, including any derived works,    *
75  * must obey and carry forward all of the terms of this license, including *
76  * obeying all GPL rules and restrictions.  For example, source code of    *
77  * the whole work must be provided and free redistribution must be         *
78  * allowed.  All GPL references to "this License", are to be treated as    *
79  * including the terms and conditions of this license text as well.        *
80  *                                                                         *
81  * Because this license imposes special exceptions to the GPL, Covered     *
82  * Work may not be combined (even as part of a larger work) with plain GPL *
83  * software.  The terms, conditions, and exceptions of this license must   *
84  * be included as well.  This license is incompatible with some other open *
85  * source licenses as well.  In some cases we can relicense portions of    *
86  * Nmap or grant special permissions to use it in other open source        *
87  * software.  Please contact fyodor@nmap.org with any such requests.       *
88  * Similarly, we don't incorporate incompatible open source software into  *
89  * Covered Software without special permission from the copyright holders. *
90  *                                                                         *
91  * If you have any questions about the licensing restrictions on using     *
92  * Nmap in other works, we are happy to help.  As mentioned above, we also *
93  * offer an alternative license to integrate Nmap into proprietary         *
94  * applications and appliances.  These contracts have been sold to dozens  *
95  * of software vendors, and generally include a perpetual license as well  *
96  * as providing support and updates.  They also fund the continued         *
97  * development of Nmap.  Please email sales@nmap.com for further           *
98  * information.                                                            *
99  *                                                                         *
100  * If you have received a written license agreement or contract for        *
101  * Covered Software stating terms other than these, you may choose to use  *
102  * and redistribute Covered Software under those terms instead of these.   *
103  *                                                                         *
104  * Source is provided to this software because we believe users have a     *
105  * right to know exactly what a program is going to do before they run it. *
106  * This also allows you to audit the software for security holes.          *
107  *                                                                         *
108  * Source code also allows you to port Nmap to new platforms, fix bugs,    *
109  * and add new features.  You are highly encouraged to send your changes   *
110  * to the dev@nmap.org mailing list for possible incorporation into the    *
111  * main distribution.  By sending these changes to Fyodor or one of the    *
112  * Insecure.Org development mailing lists, or checking them into the Nmap  *
113  * source code repository, it is understood (unless you specify            *
114  * otherwise) that you are offering the Nmap Project the unlimited,        *
115  * non-exclusive right to reuse, modify, and relicense the code.  Nmap     *
116  * will always be available Open Source, but this is important because     *
117  * the inability to relicense code has caused devastating problems for     *
118  * other Free Software projects (such as KDE and NASM).  We also           *
119  * occasionally relicense the code to third parties as discussed above.    *
120  * If you wish to specify special license conditions of your               *
121  * contributions, just say so when you send them.                          *
122  *                                                                         *
123  * This program is distributed in the hope that it will be useful, but     *
124  * WITHOUT ANY WARRANTY; without even the implied warranty of              *
125  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the Nmap      *
126  * license file for more details (it's in a COPYING file included with     *
127  * Nmap, and also available from https://svn.nmap.org/nmap/COPYING)        *
128  *                                                                         *
129  ***************************************************************************/
130 
131 
132 #ifndef GLOBAL_STRUCTURES_H
133 #define GLOBAL_STRUCTURES_H
134 
135 #include "nsock.h"
136 #include "nbase.h"
137 
138 #include <vector>
139 using namespace std;
140 
141 typedef struct service_lookup {
142   char *name;
143   u8 proto;
144   u16 portno;
145 } sevice_lookup;
146 
147 
148 typedef struct timing_options {
149   long min_connection_limit;/* minimum number of parallel connections */
150   long max_connection_limit;/* maximum number of parallel connections */
151   long auth_tries;          /* authentication attempts per connection */
152   /* number of milliseconds to wait between each connection */
153   long connection_delay;
154   /* number of connection retries after connection failure */
155   long connection_retries;
156   /* maximum cracking time regardless of success so far */
157   long long timeout;
158 
159 } timing_options;
160 
161 
162 typedef struct misc_options {
163   bool ssl;   /* use ssl */
164   char *path; /* path used in http */
165   char *db;   /* database used in modules such as MongoDB */
166   char *domain; /* domain used in domain account bruteforcing */
167 } misc_options;
168 
169 
170 typedef struct global_service {
171   bool registered;        /* true if user has specified this service */
172   service_lookup lookup;  /* name, port number and protocol */
173   timing_options timing;  /* timing options */
174   misc_options misc;      /* miscellaneous options */
175   vector <void *> module_options; /* service-specific options */
176 } global_service;
177 
178 
179 
180 #endif
181