merging in master
This commit is contained in:
commit
161ba170d9
@ -1,7 +1,7 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#ifndef _BLACKLIST_H
|
||||
#define _BLACKLIST_H
|
||||
#ifndef BLACKLIST_H
|
||||
#define BLACKLIST_H
|
||||
|
||||
int blacklist_is_allowed(uint32_t s_addr);
|
||||
void blacklist_prefix(char *ip, int prefix_len);
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifndef _CONSTRAINT_H
|
||||
#define _CONSTRAINT_H
|
||||
#ifndef CONSTRAINT_H
|
||||
#define CONSTRAINT_H
|
||||
|
||||
typedef struct _constraint constraint_t;
|
||||
typedef int value_t;
|
||||
|
@ -1,8 +1,8 @@
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifndef _LOGGER_H
|
||||
#define _LOGGER_H
|
||||
#ifndef LOGGER_H
|
||||
#define LOGGER_H
|
||||
|
||||
enum LogLevel { LOG_FATAL, LOG_ERROR, LOG_WARN, LOG_INFO, LOG_DEBUG, LOG_TRACE,
|
||||
NUM_LOGLEVELS };
|
||||
|
@ -1,8 +1,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifndef _RANDOM_H
|
||||
#define _RANDOM_H
|
||||
#ifndef RANDOM_H
|
||||
#define RANDOM_H
|
||||
|
||||
int random_bytes(void *dst, size_t n);
|
||||
|
||||
|
@ -2,8 +2,8 @@
|
||||
#include <unistd.h>
|
||||
#include <hiredis/hiredis.h>
|
||||
|
||||
#ifndef _REDIS_ZHELPERS_H
|
||||
#define _REDIS_ZHELPERS_H
|
||||
#ifndef REDIS_ZHELPERS_H
|
||||
#define REDIS_ZHELPERS_H
|
||||
|
||||
int redis_init(void);
|
||||
|
||||
|
@ -23,8 +23,8 @@
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef __RIJNDAEL_ALG_FST_H
|
||||
#define __RIJNDAEL_ALG_FST_H
|
||||
#ifndef RIJNDAEL_ALG_FST_H
|
||||
#define RIJNDAEL_ALG_FST_H
|
||||
|
||||
#define MAXKC (256/32)
|
||||
#define MAXKB (256/8)
|
||||
@ -44,4 +44,4 @@ void rijndaelEncryptRound(const u32 rk[/*4*(Nr + 1)*/], int Nr, u8 block[16], in
|
||||
void rijndaelDecryptRound(const u32 rk[/*4*(Nr + 1)*/], int Nr, u8 block[16], int rounds);
|
||||
#endif /* INTERMEDIATE_VALUE_KAT */
|
||||
|
||||
#endif /* __RIJNDAEL_ALG_FST_H */
|
||||
#endif /* RIJNDAEL_ALG_FST_H */
|
||||
|
42
src/Makefile
42
src/Makefile
@ -1,5 +1,5 @@
|
||||
CFLAGS+=-Wall -pedantic -Wextra -std=gnu99 -I../lib -I./ -Ioutput_modules -O2 -g
|
||||
LDFLAGS+=-g -pthread
|
||||
INCLUDE+=-I../lib -I./ -Ioutput_modules
|
||||
LDFLAGS+=-pthread
|
||||
LDLIBS+=-lpcap -lgmp -lm
|
||||
TARGETS=zmap
|
||||
VPATH=../lib:output_modules:probe_modules
|
||||
@ -7,38 +7,37 @@ PREFIX=/usr/local
|
||||
|
||||
INSTALL=install
|
||||
INSTALLDATA=install -m 644
|
||||
mandir=/usr/share/man/man1/
|
||||
mandir=$(PREFIX)/man/man1/
|
||||
bindir=$(PREFIX)/sbin
|
||||
|
||||
# Hardening and warnings for building with gcc
|
||||
# Maybe add -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations
|
||||
#-Wold-style-definition -Wswitch-enum
|
||||
GCCWARNINGS = -Wall -fno-strict-aliasing -W -Wfloat-equal -Wundef \
|
||||
-Wpointer-arith \
|
||||
-Wwrite-strings -Wredundant-decls -Wchar-subscripts -Wcomment \
|
||||
-Wformat=2 -Wwrite-strings -Wredundant-decls -Wno-unused-but-set-variable \
|
||||
GCCWARNINGS = -Wall -Wformat=2 -Wno-format-nonliteral\
|
||||
-pedantic -fno-strict-aliasing \
|
||||
-Wextra \
|
||||
-Wfloat-equal -Wundef -Wwrite-strings -Wredundant-decls \
|
||||
-Wnested-externs -Wbad-function-cast -Winit-self \
|
||||
-Wmissing-field-initializers \
|
||||
-Waddress -Wmissing-noreturn -Wnormalized=id \
|
||||
-Woverride-init -Wstrict-overflow=1 -Wextra -Warray-bounds \
|
||||
-Wstack-protector -Wformat -Wformat-security -Wpointer-sign -Wno-format-nonliteral -Wno-format-y2k
|
||||
GCCHARDENING=-D_FORTIFY_SOURCE=2 -fstack-protector-all -fwrapv -fPIC --param ssp-buffer-size=1
|
||||
-Wmissing-noreturn -Wnormalized=id \
|
||||
-Wstack-protector
|
||||
|
||||
GCCHARDENING=-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-all -fwrapv -fPIC --param ssp-buffer-size=1
|
||||
LDHARDENING=-z relro -z now
|
||||
|
||||
EXTRACFLAGS=-g -O2 $(EXTRA_CFLAGS) $(GCCHARDENING) $(GCCWARNINGS) -Werror
|
||||
EXTRACFLAGS=-std=gnu99 -g -O2 $(GCCHARDENING) $(GCCWARNINGS) $(EXTRA_CFLAGS) -Werror
|
||||
EXTRALDFLAGS= $(LDHARDENING)
|
||||
|
||||
CFLAGS+=-Wall $(INCLUDE) $(EXTRACFLAGS)
|
||||
CFLAGS+=$(INCLUDE) $(EXTRACFLAGS)
|
||||
LDFLAGS+=$(EXTRALDFLAGS)
|
||||
|
||||
probemodules=module_tcp_synscan.o module_icmp_echo.o #module_udp.o #ADD YOUR PROBE MODULE HERE
|
||||
outputmodules= module_csv.o #module_simple_file.o module_extended_file.o module_csv.o #ADD YOUR OUTPUT MODULE HERE
|
||||
outputmodules= module_csv.o #ADD YOUR OUTPUT MODULE HERE
|
||||
|
||||
objects=constraint.o blacklist.o cyclic.o logger.o send.o recv.o state.o monitor.o zopt.o zmap.o random.o output_modules.o packet.o probe_modules.o ${probemodules} ${outputmodules} validate.o rijndael-alg-fst.o get_gateway.o aesrand.o fieldset.o
|
||||
objects=constraint.o blacklist.o cyclic.o logger.o send.o recv.o state.o monitor.o zopt_compat.o zmap.o random.o output_modules.o packet.o probe_modules.o ${probemodules} ${outputmodules} validate.o rijndael-alg-fst.o get_gateway.o aesrand.o fieldset.o
|
||||
redis_objects=module_redis.o redis.o
|
||||
|
||||
ifeq ($(REDIS), true)
|
||||
LDLIBS+=-lhiredis
|
||||
objects+=module_redis.o redis.o
|
||||
objects+=$(redis_objects)
|
||||
CFLAGS+=-DREDIS
|
||||
endif
|
||||
|
||||
@ -49,17 +48,20 @@ $(TARGETS):
|
||||
|
||||
zmap: $(objects)
|
||||
|
||||
zopt_compat.o: zopt.c
|
||||
|
||||
zopt.c zopt.h: zopt.ggo
|
||||
gengetopt -C --no-help --no-version -i $^ -F $*
|
||||
|
||||
install: zmap
|
||||
$(INSTALL) zmap $(bindir)/zmap
|
||||
test -d /etc/zmap || (mkdir /etc/zmap && $(INSTALLDATA) ../conf/* /etc/zmap/)
|
||||
test -d $(mandir) || mkdir -p $(mandir)
|
||||
$(INSTALLDATA) ./zmap.1 $(mandir)
|
||||
echo "\n\n\n\n**************\nSuccess! ZMap is installed. Try running (as root):\nzmap -p 80 -N 10 -B 1M -o -\n**************"
|
||||
@echo "\n**************\nSuccess! ZMap is installed. Try running (as root):\nzmap -p 80 -N 10 -B 1M -o -\n**************"
|
||||
|
||||
clean:
|
||||
-rm -f $(objects) $(TARGETS)
|
||||
-rm -f $(objects) $(redis_objects) $(TARGETS)
|
||||
|
||||
.PHONY: install clean
|
||||
|
||||
|
@ -8,8 +8,8 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifndef _AESRAND_H
|
||||
#define _AESRAND_H
|
||||
#ifndef AESRAND_H
|
||||
#define AESRAND_H
|
||||
|
||||
void aesrand_init(uint32_t seed);
|
||||
|
||||
|
@ -8,8 +8,8 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifndef _CYCLIC_H
|
||||
#define _CYCLIC_H
|
||||
#ifndef CYCLIC_H
|
||||
#define CYCLIC_H
|
||||
|
||||
int cyclic_init(uint32_t, uint32_t);
|
||||
|
||||
|
@ -6,8 +6,8 @@
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
#ifndef _GET_GATEWAY_H
|
||||
#define _GET_GATEWAY_H
|
||||
#ifndef GET_GATEWAY_H
|
||||
#define GET_GATEWAY_H
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
||||
|
@ -6,8 +6,8 @@
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
#ifndef _MONITOR_H
|
||||
#define _MONITOR_H
|
||||
#ifndef MONITOR_H
|
||||
#define MONITOR_H
|
||||
|
||||
void monitor_run();
|
||||
|
||||
|
@ -6,8 +6,8 @@
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
#ifndef HEADER_OUTPUT_MODULES_H
|
||||
#define HEADER_OUTPUT_MODULES_H
|
||||
#ifndef OUTPUT_MODULES_H
|
||||
#define OUTPUT_MODULES_H
|
||||
|
||||
#include "../state.h"
|
||||
#include "../fieldset.h"
|
||||
|
@ -6,8 +6,8 @@
|
||||
#include <netinet/ip_icmp.h>
|
||||
#include <netinet/udp.h>
|
||||
|
||||
#ifndef HEADER_ZMAP_PACKET_H
|
||||
#define HEADER_ZMAP_PACKET_H
|
||||
#ifndef PACKET_H
|
||||
#define PACKET_H
|
||||
|
||||
#define MAX_PACKET_SIZE 4096
|
||||
|
||||
|
@ -6,8 +6,8 @@
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
#ifndef _RECV_H
|
||||
#define _RECV_H
|
||||
#ifndef RECV_H
|
||||
#define RECV_H
|
||||
|
||||
int recv_update_pcap_stats(void);
|
||||
int recv_run(pthread_mutex_t *recv_ready_mutex);
|
||||
|
@ -6,8 +6,8 @@
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
#ifndef _SEND_H
|
||||
#define _SEND_H
|
||||
#ifndef SEND_H
|
||||
#define SEND_H
|
||||
|
||||
int send_init(void);
|
||||
int send_run(void);
|
||||
|
@ -16,8 +16,8 @@
|
||||
#include "types.h"
|
||||
#include "fieldset.h"
|
||||
|
||||
#ifndef _STATE_H
|
||||
#define _STATE_H
|
||||
#ifndef STATE_H
|
||||
#define STATE_H
|
||||
|
||||
#define MAX_PACKET_SIZE 4096
|
||||
|
||||
|
@ -6,8 +6,8 @@
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
#ifndef _VALIDATE_H
|
||||
#define _VALIDATE_H
|
||||
#ifndef VALIDATE_H
|
||||
#define VALIDATE_H
|
||||
|
||||
#define VALIDATE_BYTES 16
|
||||
|
||||
|
7
src/zopt_compat.c
Normal file
7
src/zopt_compat.c
Normal file
@ -0,0 +1,7 @@
|
||||
#if __GNUC__ < 4
|
||||
#error "gcc version >= 4 is required"
|
||||
#elif __GNUC_MINOR__ >= 6
|
||||
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
|
||||
#endif
|
||||
|
||||
#include "zopt.c"
|
Loading…
Reference in New Issue
Block a user