Skip to content

Commit fb88324

Browse files
Merge pull request #40 from Alfredsson418/argtable3
Moved from argp to argtable3 to make Windows and MacOS support
2 parents 91f3320 + b849bc6 commit fb88324

File tree

17 files changed

+7102
-258
lines changed

17 files changed

+7102
-258
lines changed

include/hawkeyes.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,22 @@
55
#include <stdbool.h>
66
#include <string.h>
77

8+
#include "../packages/argtable3.h"
89
#include "constans.h"
910
#include "other/ip/convert.h"
11+
#include "other/ip/domain.h"
1012
#include "other/network_interface.h"
1113
#include "other/parse_ports.h"
1214
#include "other/permissions.h"
1315
#include "other/port_scan_lookup.h"
1416
#include "other/service_detection.h"
1517
#include "other/service_parser.h"
16-
#include "other/terminal_args.h"
1718
#include "other/transfer_layers.h"
1819
#include "scan_methods/multithread_scanning.h"
20+
#include "scan_methods/scan_structs.h"
21+
#include "scan_methods/tcp/connect.h"
22+
#include "scan_methods/tcp/half_sync.h"
23+
#include "scan_methods/udp/echo_responce.h"
1924
#include "ui/display_file.h"
2025
#include "ui/motd.h"
2126
#include "ui/print_macro.h"

include/other/parse_ports.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
Length of array.
1515
1616
*/
17-
unsigned int parse_ports(char *str, unsigned short **ports);
17+
unsigned int parse_ports(const char *str, unsigned short **ports);

include/other/terminal_args.h

Lines changed: 0 additions & 37 deletions
This file was deleted.

include/scan_methods/scan_structs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ typedef struct {
1919
// Used as a universal argument for every scanning method
2020
typedef struct {
2121
struct sockaddr_storage addr;
22-
interface_info *interface;
22+
interface_info interface;
2323
unsigned int timeout;
2424
unsigned short port;
2525
} scan_arg_t;

makefile

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ CC = gcc
55
NAME = hawk
66

77
# Directories
8+
PACKAGES = packages
89
BUILD = build
910
SRC = src
1011

@@ -20,19 +21,23 @@ VERSION = $(shell jq .version $(VERSION_FILE))
2021
# Flags for compiling
2122
DEBUG_CFLAGS = -Wall -g
2223
RELEASE_CFLAGS =
23-
LDFLAGS = -lpcap --pthread -lcjson
24+
LDFLAGS = -lpcap --pthread -lcjson -lm
25+
# lm is used by argtable3
26+
2427

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

2832
# Generate object file names from source file names
29-
OBJFILES = $(patsubst $(SRC)/%.c, $(BUILD)/%.o, $(SRCFILES))
33+
OBJFILES = $(patsubst $(SRC)/%.c, $(BUILD)/$(SRC)/%.o, $(SRCFILES))
34+
PKG_OBJFILES = $(patsubst $(PACKAGES)/%.c, $(BUILD)/$(PACKAGES)/%.o, $(PKG_SRCFILES))
3035

3136
.PHONY: debug release clean setup-version
3237

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

4247
# Target to build the executable with release flags
4348
build_release: CFLAGS = $(RELEASE_CFLAGS)
44-
build_release: $(OBJFILES)
49+
build_release: $(OBJFILES) $(PKG_OBJFILES)
4550
@echo "Building $(NAME) in release mode"
4651
@$(CC) $(CFLAGS) $^ -o $(NAME) $(LDFLAGS)
4752
@echo "Done!"
@@ -54,14 +59,20 @@ release:
5459

5560

5661
# Rule to compile each source file into an object file
57-
$(BUILD)/%.o: $(SRC)/%.c
62+
# Rule to compile each source file into an object file
63+
$(BUILD)/$(SRC)/%.o: $(SRC)/%.c
64+
@mkdir -p $(@D)
65+
@echo "Compiling $<"
66+
@$(CC) $(CFLAGS) -c -o $@ $<
67+
68+
$(BUILD)/$(PACKAGES)/%.o: $(PACKAGES)/%.c
5869
@mkdir -p $(@D)
5970
@echo "Compiling $<"
6071
@$(CC) $(CFLAGS) -c -o $@ $<
6172

6273
# Target to clean up generated file
6374
clean:
64-
@rm -rf $(OBJFILES) $(NAME)
75+
@rm -rf $(BUILD) $(NAME)
6576

6677
setup-version:
6778
@echo "Setting up version"

0 commit comments

Comments
 (0)