Skip to content

Commit

Permalink
-iL and --exclude options working
Browse files Browse the repository at this point in the history
  • Loading branch information
ithilgore committed May 6, 2009
1 parent 56f4be0 commit 5a309b6
Show file tree
Hide file tree
Showing 14 changed files with 401 additions and 628 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export NSOCKDIR=nsock

DEFS = -DHAVE_CONFIG_H
DEFS += -D_FORTIFY_SOURCE=2
CXXFLAGS = -g -O2 -Wall -fno-strict-aliasing $(DBGFLAGS) $(CCOPT) $(DEFS)
CXXFLAGS = -O0 -Wall -fno-strict-aliasing $(DBGFLAGS) $(DEFS)
CPPFLAGS = -Inbase -Insock/include
export CFLAGS = $(CXXFLAGS)
STATIC =
Expand Down
2 changes: 1 addition & 1 deletion Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export NSOCKDIR=@NSOCKDIR@

DEFS = @DEFS@
DEFS += -D_FORTIFY_SOURCE=2
CXXFLAGS = @CXXFLAGS@ $(DBGFLAGS) $(CCOPT) $(DEFS)
CXXFLAGS = @CXXFLAGS@ $(DBGFLAGS) $(DEFS)
CPPFLAGS = @CPPFLAGS@
export CFLAGS = $(CXXFLAGS)
STATIC =
Expand Down
1 change: 1 addition & 0 deletions NcrackOps.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class NcrackOps {
int debugging;
int verbose;
int numhosts_scanned;
int max_group_size;

private:
int addressfamily; /* Address family: AF_INET or AF_INET6 */
Expand Down
14 changes: 8 additions & 6 deletions TargetGroup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,12 @@

/* $Id: TargetGroup.cc 12955 2009-04-15 00:37:03Z fyodor $ */

#include "NcrackOps.h"
#include "TargetGroup.h"
#include "utils.h"

extern NcrackOps o;


TargetGroup::TargetGroup() {
Initialize();
Expand Down Expand Up @@ -407,9 +410,9 @@ int TargetGroup::get_next_host(struct sockaddr_storage *ss, size_t *sslen) {
#if HAVE_SOCKADDR_SA_LEN
sin->sin_len = *sslen;
#endif
// if (o.debugging > 2) {
printf("doing %d.%d.%d.%d = %d.%d.%d.%d\n", current[0], current[1], current[2], current[3], addresses[0][current[0]],addresses[1][current[1]],addresses[2][current[2]],addresses[3][current[3]]);
// }
if (o.debugging > 2) {
printf("doing %d.%d.%d.%d = %d.%d.%d.%d\n", current[0], current[1], current[2], current[3], addresses[0][current[0]],addresses[1][current[1]],addresses[2][current[2]],addresses[3][current[3]]);
}
/* Set the IP to the current value of everything */
sin->sin_addr.s_addr = htonl(addresses[0][current[0]] << 24 |
addresses[1][current[1]] << 16 |
Expand Down Expand Up @@ -455,6 +458,7 @@ int TargetGroup::get_next_host(struct sockaddr_storage *ss, size_t *sslen) {
}
ipsleft--;

/* NCRACK-TODO: use this for restore procedure */
/* If we are resuming from a previous scan, we have already finished
scans up to o.resume_ip. */
//if (sin->sin_family == AF_INET && o.resume_ip.s_addr) {
Expand Down Expand Up @@ -502,14 +506,12 @@ int TargetGroup::return_last_host() {
The target_expressions array MUST REMAIN VALID IN MEMORY as long as
this class instance is used -- the array is NOT copied.
*/
HostGroupState::HostGroupState(int lookahead, int rnd,
char *expr[], int numexpr) {
HostGroupState::HostGroupState(int lookahead, char *expr[], int numexpr) {
assert(lookahead > 0);
hostbatch = (Target **) safe_zalloc(sizeof(Target *) * lookahead);
max_batch_sz = lookahead;
current_batch_sz = 0;
next_batch_no = 0;
randomize = rnd;
target_expressions = expr;
num_expressions = numexpr;
next_expression = 0;
Expand Down
6 changes: 1 addition & 5 deletions TargetGroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,17 +162,13 @@ class TargetGroup {

class HostGroupState {
public:
HostGroupState(int lookahead, int randomize, char *target_expressions[],
int num_expressions);
HostGroupState(int lookahead, char *target_expressions[], int num_expressions);
~HostGroupState();
Target **hostbatch;
int max_batch_sz; /* The size of the hostbatch[] array */
int current_batch_sz; /* The number of VALID members of hostbatch[] */
int next_batch_no; /* The index of the next hostbatch[] member to be given
back to the user */
int randomize; /* Whether each batch should be "shuffled" prior to the ping
scan (they will also be out of order when given back one
at a time to the client program */
char **target_expressions; /* An array of target expression strings, passed
to us by the client (client is also in charge
of deleting it AFTER it is done with the
Expand Down
Loading

0 comments on commit 5a309b6

Please sign in to comment.