Skip to content

Commit 2e60243

Browse files
committed
Move osscan-related structs to osscan.h from global_structures.h
1 parent 764cb88 commit 2e60243

File tree

6 files changed

+71
-71
lines changed

6 files changed

+71
-71
lines changed

FPEngine.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129

130130
#include "nsock.h"
131131
#include <vector>
132-
#include "nmap.h"
132+
#include "osscan.h"
133133
#include "libnetutil/npacket.h"
134134

135135
/* Mention some classes here so we don't have to place the declarations in

FingerPrintResults.h

-10
Original file line numberDiff line numberDiff line change
@@ -141,16 +141,6 @@ struct OS_Classification_Results {
141141
int overall_results; /* OSSCAN_TOOMANYMATCHES, OSSCAN_NOMATCHES, OSSCAN_SUCCESS, etc */
142142
};
143143

144-
/* The method used to calculate the Target::distance, included in OS
145-
fingerprints. */
146-
enum dist_calc_method {
147-
DIST_METHOD_NONE,
148-
DIST_METHOD_LOCALHOST,
149-
DIST_METHOD_DIRECT,
150-
DIST_METHOD_ICMP,
151-
DIST_METHOD_TRACEROUTE
152-
};
153-
154144
class FingerPrintResults {
155145
public: /* For now ... a lot of the data members should be made private */
156146
FingerPrintResults();

NmapOps.h

+1
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@
126126
#ifndef NMAP_OPS_H
127127
#define NMAP_OPS_H
128128

129+
#include "osscan.h" /* FingerPrintDB */
129130
#include "output.h"
130131
#include <nsock.h>
131132
#include <string>

global_structures.h

-56
Original file line numberDiff line numberDiff line change
@@ -127,62 +127,6 @@
127127
#ifndef GLOBAL_STRUCTURES_H
128128
#define GLOBAL_STRUCTURES_H
129129

130-
#include <vector>
131-
132-
struct AVal {
133-
const char *attribute;
134-
const char *value;
135-
136-
bool operator<(const AVal& other) const {
137-
return strcmp(attribute, other.attribute) < 0;
138-
}
139-
};
140-
141-
struct OS_Classification {
142-
const char *OS_Vendor;
143-
const char *OS_Family;
144-
const char *OS_Generation; /* Can be NULL if unclassified */
145-
const char *Device_Type;
146-
std::vector<const char *> cpe;
147-
};
148-
149-
/* A description of an operating system: a human-readable name and a list of
150-
classifications. */
151-
struct FingerMatch {
152-
int line; /* For reference prints, the line # in nmap-os-db */
153-
char *OS_name;
154-
std::vector<OS_Classification> OS_class;
155-
156-
FingerMatch() {
157-
line = -1;
158-
OS_name = NULL;
159-
}
160-
};
161-
162-
struct FingerTest {
163-
const char *name;
164-
std::vector<struct AVal> results;
165-
bool operator<(const FingerTest& other) const {
166-
return strcmp(name, other.name) < 0;
167-
}
168-
};
169-
170-
struct FingerPrint {
171-
FingerMatch match;
172-
std::vector<FingerTest> tests;
173-
FingerPrint();
174-
void sort();
175-
};
176-
177-
/* This structure contains the important data from the fingerprint
178-
database (nmap-os-db) */
179-
struct FingerPrintDB {
180-
FingerPrint *MatchPoints;
181-
std::vector<FingerPrint *> prints;
182-
183-
FingerPrintDB();
184-
~FingerPrintDB();
185-
};
186130

187131
struct seq_info {
188132
int responses;

libnetutil/netutil.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ extern "C" {
138138
#endif
139139

140140
#include "dnet.h"
141-
141+
#include <nbase.h>
142142

143143
/* It is VERY important to never change the value of these two constants.
144144
* Specially, OP_FAILURE should never be positive, as some pieces of code take

osscan.h

+68-3
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,11 @@
126126
#ifndef OSSCAN_H
127127
#define OSSCAN_H
128128

129-
#include "FingerPrintResults.h"
130-
#include "Target.h"
129+
#include <nbase.h>
130+
#include <vector>
131+
132+
class Target;
133+
class FingerPrintResultsIPv4;
131134

132135
#define OSSCAN_SUCCESS 0
133136
#define OSSCAN_NOMATCHES -1
@@ -136,9 +139,71 @@
136139
/* We won't even consider matches with a lower accuracy than this */
137140
#define OSSCAN_GUESS_THRESHOLD 0.85
138141

142+
/* The method used to calculate the Target::distance, included in OS
143+
fingerprints. */
144+
enum dist_calc_method {
145+
DIST_METHOD_NONE,
146+
DIST_METHOD_LOCALHOST,
147+
DIST_METHOD_DIRECT,
148+
DIST_METHOD_ICMP,
149+
DIST_METHOD_TRACEROUTE
150+
};
151+
139152
/********************** STRUCTURES ***********************************/
140153

141-
/* moved to global_structures.h */
154+
struct AVal {
155+
const char *attribute;
156+
const char *value;
157+
158+
bool operator<(const AVal& other) const {
159+
return strcmp(attribute, other.attribute) < 0;
160+
}
161+
};
162+
163+
struct OS_Classification {
164+
const char *OS_Vendor;
165+
const char *OS_Family;
166+
const char *OS_Generation; /* Can be NULL if unclassified */
167+
const char *Device_Type;
168+
std::vector<const char *> cpe;
169+
};
170+
171+
/* A description of an operating system: a human-readable name and a list of
172+
classifications. */
173+
struct FingerMatch {
174+
int line; /* For reference prints, the line # in nmap-os-db */
175+
char *OS_name;
176+
std::vector<OS_Classification> OS_class;
177+
178+
FingerMatch() {
179+
line = -1;
180+
OS_name = NULL;
181+
}
182+
};
183+
184+
struct FingerTest {
185+
const char *name;
186+
std::vector<struct AVal> results;
187+
bool operator<(const FingerTest& other) const {
188+
return strcmp(name, other.name) < 0;
189+
}
190+
};
191+
192+
struct FingerPrint {
193+
FingerMatch match;
194+
std::vector<FingerTest> tests;
195+
FingerPrint();
196+
void sort();
197+
};
198+
/* This structure contains the important data from the fingerprint
199+
database (nmap-os-db) */
200+
struct FingerPrintDB {
201+
FingerPrint *MatchPoints;
202+
std::vector<FingerPrint *> prints;
203+
204+
FingerPrintDB();
205+
~FingerPrintDB();
206+
};
142207

143208
/********************** PROTOTYPES ***********************************/
144209

0 commit comments

Comments
 (0)