Voor mijn afstudeerstage wil ik gebruik maken van de "voip vulnerability toolkit" welke ter beschikking wordt gesteld op de securelogix website. Programma's uit deze toolkit worden gebruikt in het boek "Hacking Exposed VoIP". Op basis van dit boek heb ik enkele testcases samengesteld.
Als systeem maak ik gebruik van een virtualBox virtuele opstelling met Debian 5.0. De volgende packages zijn geinstalleerd:
g++/lenny uptodate 4:4.3.2-2
g++-4.3/lenny uptodate 4.3.2-1.1
gcc/lenny uptodate 4:4.3.2-2
gcc-4.2-base/lenny uptodate 4.2.4-6
gcc-4.3/lenny uptodate 4.3.2-1.1
gcc-4.3-base/lenny uptodate 4.3.2-1.1
libc6/lenny uptodate 2.7-18
libc6-dev/lenny uptodate 2.7-18
libc6-i686/lenny uptodate 2.7-18
libgcc1/lenny uptodate 1:4.3.2-1.1
libgcrypt11/lenny uptodate 1.4.1-1
libgdbm3/lenny uptodate 1.8.3-3
libstdc++6/lenny uptodate 4.3.2-1.1
libstdc++6-4.3-dev/lenny uptodate 4.3.2-1.1
libtasn1-3/lenny uptodate 1.4-1
(Heb even weggelaten wat volgens mij niet van toepassing is)
Als ik de toolkit download moet ik eerst de hack_library installeren waarbij een Makefile is bijgeleverd. Als ik deze "make" dan krijg ik de volgende foutmelding:
C code: (hack_library.c)
hack_library.h:
Over de toolkit zelf is op internet niets te vinden en heb in een mail aan de schrijvers in eerste instantie snel antwoord gekregen. Mijn 2e mail is al enkele dagen onbeantwoord, vandaar dat ik het zo probeer.
Als systeem maak ik gebruik van een virtualBox virtuele opstelling met Debian 5.0. De volgende packages zijn geinstalleerd:
g++/lenny uptodate 4:4.3.2-2
g++-4.3/lenny uptodate 4.3.2-1.1
gcc/lenny uptodate 4:4.3.2-2
gcc-4.2-base/lenny uptodate 4.2.4-6
gcc-4.3/lenny uptodate 4.3.2-1.1
gcc-4.3-base/lenny uptodate 4.3.2-1.1
libc6/lenny uptodate 2.7-18
libc6-dev/lenny uptodate 2.7-18
libc6-i686/lenny uptodate 2.7-18
libgcc1/lenny uptodate 1:4.3.2-1.1
libgcrypt11/lenny uptodate 1.4.1-1
libgdbm3/lenny uptodate 1.8.3-3
libstdc++6/lenny uptodate 4.3.2-1.1
libstdc++6-4.3-dev/lenny uptodate 4.3.2-1.1
libtasn1-3/lenny uptodate 1.4-1
(Heb even weggelaten wat volgens mij niet van toepassing is)
Als ik de toolkit download moet ik eerst de hack_library installeren waarbij een Makefile is bijgeleverd. Als ik deze "make" dan krijg ik de volgende foutmelding:
code:
1
2
| hack_library.c: In function âStr2IPâ: hack_library.c:85: warning: incompatible implicit declaration of built-in function âstrchrâ |
C code: (hack_library.c)
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
| //-------------------------------------------------------------------------------
#include "hack_library.h"
//-------------------------------------------------------------------------------
//
// Str2IP
//
// Called to convert a character string to an int IP address in network byte
// order. The string must be in dot notation. Note: This is a destructive call
// to the input string!
//
//-----------------------------------------------------------------------------
int Str2IP ( char *str, int *ipNum )
{
unsigned char str_val[4];
int *int_val = (int*) str_val;
int i = 0;
int val;
char *digits;
char *end = NULL;
char *ptr = str;
//
// Skip leading spaces
//
while ( *ptr == ' ' ) {
ptr++;
}
digits = ptr;
//
// Make sure the string is digits and '.'
//
while ( *ptr != '\0' && *ptr != ' ' ) {
if ( (!isdigit(*ptr)) && (*ptr != '.' ) ) {
return ( EXIT_FAILURE );
} else if ( *ptr == '.' ) {
if ( i == 3 ) {
return ( EXIT_FAILURE );
} else {
i++;
}
ptr++;
} else {
ptr++;
}
}
if ( i != 3 ) {
return ( EXIT_FAILURE );
}
ptr = digits;
for ( i = 0; i < 4; i++ ) {
if ( i<3 && (end = strchr(ptr,'.')) == NULL ) {
return ( EXIT_FAILURE );
}
*end = '\0';
val = atoi( ptr );
if ( val > 255 || ! isdigit(*ptr) ) {
return ( EXIT_FAILURE );
}
str_val[i] = (unsigned char) val;
ptr = end + 1;
}
*ipNum = *int_val;
return ( EXIT_SUCCESS );
}
//-----------------------------------------------------------------------------
//
// DumpPacket
//
// Dump out the contents of the packet in a standard form.
// The packetSize is the length in bytes. Output appears
// in the following form:
//
// 0000 xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx
// 0010 xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx
// 0020 xx xx xx
//
// where the 1st column is the offset from the beginning of the
// packet for the next byte and each xx is a hex byte value.
//
// return 0 for success, -1 for failure.
//
//-----------------------------------------------------------------------------
int DumpPacket( char *psPacket, int packetSize )
{
int lines = packetSize / 16;
int rem = packetSize % 16;
int m = 0;
int n = 0;
if ( ( !psPacket ) || ( packetSize < 0 ) ) {
return -1;
}
printf( "\nPacket:" );
for ( m = 0; m < lines; m++ ) {
//
// Print first 8 bytes of current line
//
printf( "\n%04.4x ", m * 16 ); // Row offset leader
for ( ; n < ( m * 16 + 8 ); n++ ) {
printf( " %02.2x", (unsigned char) psPacket[ n ] );
}
printf ( " " ); // Extra space separating columns of 8
//
// Print last 8 bytes of current line
//
for ( ; ( n < ( m + 1 ) * 16 ); n++ ) {
printf( " %02.2x", (unsigned char) psPacket[ n ] );
}
}
//
// Print remainder of bytes that do not form a full 16 byte line. Print up to
// first 8 bytes of last line
//
if ( n != packetSize ) {
printf( "\n%4.4x ", m * 16 ); // Row offset leader
for ( ; ( n < ( m * 16 + 8 ) ) && ( n < packetSize ); n++ ) {
printf( " %02.2x", (unsigned char) psPacket[ n ] );
}
printf ( " " ); // Extra space separating columns of 8
//
// Print up to next 8 bytes of last line
//
for ( ; ( n < ( ( m + 1 ) * 16 ) ) && ( n < packetSize ); n++ ) {
printf( " %02.2x", (unsigned char) psPacket[ n ] );
}
}
printf( "\n\n" );
return ( 0 );
} // end DumpPacket()
//-----------------------------------------------------------------------------
//
// GetNextGuid
//
// Generate a 36 character random ID.
//
//-----------------------------------------------------------------------------
char *GetNextGuid ( void )
{
char *guid;
int r1;
int r2;
int r3;
int ur;
struct timeval tv;
ur = open( "/dev/urandom", O_RDONLY );
if ( ur < 0 ) {
r1 = random();
r2 = random();
r3 = random();
} else {
if ( read( ur, &r1, sizeof( r1 ) ) < ( int )sizeof( r1 ) ) {
r1 = random();
}
if ( read( ur, &r2, sizeof( r2 ) ) < ( int )sizeof( r2 ) ) {
r2 = random();
}
if ( read( ur, &r3, sizeof( r3 ) ) < ( int )sizeof( r3 ) ) {
r3 = random();
}
close( ur );
}
guid = (char *)malloc( 37 );
if ( !guid ) {
fprintf( stderr,
"GetNextGuid: out of memory",
__FILE__,
__LINE__ );
return ( NULL );
}
gettimeofday( &tv, NULL );
snprintf( guid, 37,
"%1x%05x%02x-%04x-%04x-%04x-%08x%04x",
( unsigned int ) tv.tv_sec & 0x0000000f,
( unsigned int ) tv.tv_usec & 0x000fffff,
( unsigned int ) r3 >> 16 & 0x000000ff,
( unsigned int ) tv.tv_sec >> 4 & 0x0000ffff,
( unsigned int )( tv.tv_sec >> 20 & 0x00000fff ) | 0x00004000,
( unsigned int )( r1 & 0x00003fff ) | 0x00008000,
( unsigned int ) r2 & 0xffffffff,
( unsigned int ) r3 & 0x0000ffff );
return ( guid );
} |
hack_library.h:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
| #ifndef __HACK_LIBRARY_H #define __HACK_LIBRARY_H #include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <fcntl.h> int Str2IP ( char *str, int *ipNum ); int DumpPacket ( char *psPacket, int packetSize ); char *GetNextGuid ( void ); #endif // __HACK_LIBRARY_H |
Over de toolkit zelf is op internet niets te vinden en heb in een mail aan de schrijvers in eerste instantie snel antwoord gekregen. Mijn 2e mail is al enkele dagen onbeantwoord, vandaar dat ik het zo probeer.