Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion include/hawkeyes.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,22 @@
#include <stdbool.h>
#include <string.h>

#include "../packages/argtable3.h"
#include "constans.h"
#include "other/ip/convert.h"
#include "other/ip/domain.h"
#include "other/network_interface.h"
#include "other/parse_ports.h"
#include "other/permissions.h"
#include "other/port_scan_lookup.h"
#include "other/service_detection.h"
#include "other/service_parser.h"
#include "other/terminal_args.h"
#include "other/transfer_layers.h"
#include "scan_methods/multithread_scanning.h"
#include "scan_methods/scan_structs.h"
#include "scan_methods/tcp/connect.h"
#include "scan_methods/tcp/half_sync.h"
#include "scan_methods/udp/echo_responce.h"
#include "ui/display_file.h"
#include "ui/motd.h"
#include "ui/print_macro.h"
Expand Down
2 changes: 1 addition & 1 deletion include/other/parse_ports.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
Length of array.

*/
unsigned int parse_ports(char *str, unsigned short **ports);
unsigned int parse_ports(const char *str, unsigned short **ports);
37 changes: 0 additions & 37 deletions include/other/terminal_args.h

This file was deleted.

2 changes: 1 addition & 1 deletion include/scan_methods/scan_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ typedef struct {
// Used as a universal argument for every scanning method
typedef struct {
struct sockaddr_storage addr;
interface_info *interface;
interface_info interface;
unsigned int timeout;
unsigned short port;
} scan_arg_t;
Expand Down
23 changes: 17 additions & 6 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ CC = gcc
NAME = hawk

# Directories
PACKAGES = packages
BUILD = build
SRC = src

Expand All @@ -20,19 +21,23 @@ VERSION = $(shell jq .version $(VERSION_FILE))
# Flags for compiling
DEBUG_CFLAGS = -Wall -g
RELEASE_CFLAGS =
LDFLAGS = -lpcap --pthread -lcjson
LDFLAGS = -lpcap --pthread -lcjson -lm
# lm is used by argtable3


# Get all the source files in the SRC directory and its subdirectories
SRCFILES = $(shell find $(SRC) -name '*.c')
PKG_SRCFILES = $(shell find $(PACKAGES) -name '*.c')

# Generate object file names from source file names
OBJFILES = $(patsubst $(SRC)/%.c, $(BUILD)/%.o, $(SRCFILES))
OBJFILES = $(patsubst $(SRC)/%.c, $(BUILD)/$(SRC)/%.o, $(SRCFILES))
PKG_OBJFILES = $(patsubst $(PACKAGES)/%.c, $(BUILD)/$(PACKAGES)/%.o, $(PKG_SRCFILES))

.PHONY: debug release clean setup-version

# Target to build the executable with debug flags
debug: CFLAGS = $(DEBUG_CFLAGS)
debug: $(OBJFILES)
debug: $(OBJFILES) $(PKG_OBJFILES)
@$(MAKE) setup-version --no-print-directory
@echo "Building $(NAME) in debug mode"
@$(CC) $(CFLAGS) $^ -o $(NAME) $(LDFLAGS)
Expand All @@ -41,7 +46,7 @@ debug: $(OBJFILES)

# Target to build the executable with release flags
build_release: CFLAGS = $(RELEASE_CFLAGS)
build_release: $(OBJFILES)
build_release: $(OBJFILES) $(PKG_OBJFILES)
@echo "Building $(NAME) in release mode"
@$(CC) $(CFLAGS) $^ -o $(NAME) $(LDFLAGS)
@echo "Done!"
Expand All @@ -54,14 +59,20 @@ release:


# Rule to compile each source file into an object file
$(BUILD)/%.o: $(SRC)/%.c
# Rule to compile each source file into an object file
$(BUILD)/$(SRC)/%.o: $(SRC)/%.c
@mkdir -p $(@D)
@echo "Compiling $<"
@$(CC) $(CFLAGS) -c -o $@ $<

$(BUILD)/$(PACKAGES)/%.o: $(PACKAGES)/%.c
@mkdir -p $(@D)
@echo "Compiling $<"
@$(CC) $(CFLAGS) -c -o $@ $<

# Target to clean up generated file
clean:
@rm -rf $(OBJFILES) $(NAME)
@rm -rf $(BUILD) $(NAME)

setup-version:
@echo "Setting up version"
Expand Down
Loading