Skip to content

Commit 4ff25ba

Browse files
authored
Merge pull request #43 from sea-kg/version-0.4.3
Version 0.4.3
2 parents aefca57 + 322e9a8 commit 4ff25ba

File tree

347 files changed

+19214
-11221
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

347 files changed

+19214
-11221
lines changed

.dockerignore

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,11 @@
1-
.git
1+
.git
2+
dckr_mysql
3+
tmp/*
4+
.wsjcpp/*
5+
docs/*
6+
misc/*
7+
data_test/*
8+
game-simulation/*
9+
dockers/*
10+
vulnbox/*
11+
tests/*

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
jury.d/logs/*.log
33
dckr_mysql/*
44
vulnbox/example_service1/flags/*
5+
game-simulation/vulnbox/service3_php/tmp/*
6+
*.log
7+
unit-tests.wsjcpp/tmp/*
8+
data_test/*
9+
ctf01d
10+
tmp/*
11+
.wsjcpp/*
512
*.log
613

714
# Prerequisites

.travis.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ addons:
2222

2323
# Build steps
2424
script:
25-
- cd fhq-jury-ad
2625
- ./clean.sh
2726
- ./build_simple.sh
27+
- cd unit-tests.wsjcpp
28+
- ./build_simple.sh
29+
- ./unit-tests

CMakeLists.txt

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
cmake_minimum_required(VERSION 3.0)
2+
3+
project(ctf01d)
4+
5+
include(${CMAKE_CURRENT_SOURCE_DIR}/src.wsjcpp/CMakeLists.txt)
6+
7+
#### BEGIN_WSJCPP_APPEND
8+
#### END_WSJCPP_APPEND
9+
10+
set(CMAKE_CXX_STANDARD 11)
11+
set(EXECUTABLE_OUTPUT_PATH ${ctf01d_SOURCE_DIR})
12+
# set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
13+
14+
# Sources
15+
16+
# include header dirs
17+
list (APPEND WSJCPP_INCLUDE_DIRS "src")
18+
list (APPEND WSJCPP_INCLUDE_DIRS "src/argument_processors")
19+
list (APPEND WSJCPP_INCLUDE_DIRS "src/checker")
20+
list (APPEND WSJCPP_INCLUDE_DIRS "src/scoreboard")
21+
list (APPEND WSJCPP_INCLUDE_DIRS "src/storages")
22+
list (APPEND WSJCPP_INCLUDE_DIRS "src/storages/file")
23+
list (APPEND WSJCPP_INCLUDE_DIRS "src/service_locator")
24+
list (APPEND WSJCPP_INCLUDE_DIRS "src/http_handlers")
25+
26+
# argument processors
27+
list (APPEND WSJCPP_SOURCES "./src/argument_processors/argument_processor_check.h")
28+
list (APPEND WSJCPP_SOURCES "./src/argument_processors/argument_processor_check.cpp")
29+
list (APPEND WSJCPP_SOURCES "./src/argument_processors/argument_processor_clean.h")
30+
list (APPEND WSJCPP_SOURCES "./src/argument_processors/argument_processor_clean.cpp")
31+
list (APPEND WSJCPP_SOURCES "./src/argument_processors/argument_processor_ctf01d_main.h")
32+
list (APPEND WSJCPP_SOURCES "./src/argument_processors/argument_processor_ctf01d_main.cpp")
33+
list (APPEND WSJCPP_SOURCES "./src/argument_processors/argument_processor_start.h")
34+
list (APPEND WSJCPP_SOURCES "./src/argument_processors/argument_processor_start.cpp")
35+
list (APPEND WSJCPP_SOURCES "./src/argument_processors/argument_processor_version.h")
36+
list (APPEND WSJCPP_SOURCES "./src/argument_processors/argument_processor_version.cpp")
37+
list (APPEND WSJCPP_SOURCES "./src/argument_processors/argument_processor_web_test.h")
38+
list (APPEND WSJCPP_SOURCES "./src/argument_processors/argument_processor_web_test.cpp")
39+
40+
# employees
41+
list (APPEND WSJCPP_SOURCES "./src/service_locator/employ_team_logos.h")
42+
list (APPEND WSJCPP_SOURCES "./src/service_locator/employ_team_logos.cpp")
43+
list (APPEND WSJCPP_SOURCES "./src/service_locator/employ_flags.h")
44+
list (APPEND WSJCPP_SOURCES "./src/service_locator/employ_flags.cpp")
45+
list (APPEND WSJCPP_SOURCES "./src/service_locator/employ_scoreboard.h")
46+
list (APPEND WSJCPP_SOURCES "./src/service_locator/employ_scoreboard.cpp")
47+
list (APPEND WSJCPP_SOURCES "./src/service_locator/employ_config.h")
48+
list (APPEND WSJCPP_SOURCES "./src/service_locator/employ_config.cpp")
49+
50+
# checker
51+
list (APPEND WSJCPP_SOURCES "src/checker/dorunchecker.h")
52+
list (APPEND WSJCPP_SOURCES "src/checker/dorunchecker.cpp")
53+
list (APPEND WSJCPP_SOURCES "src/checker/service_checker_thread.h")
54+
list (APPEND WSJCPP_SOURCES "src/checker/service_checker_thread.cpp")
55+
56+
# http_handlers
57+
list (APPEND WSJCPP_SOURCES "src/http_handlers/http_handler_api_v1.h")
58+
list (APPEND WSJCPP_SOURCES "src/http_handlers/http_handler_api_v1.cpp")
59+
list (APPEND WSJCPP_SOURCES "src/http_handlers/http_handler_web_folder.h")
60+
list (APPEND WSJCPP_SOURCES "src/http_handlers/http_handler_web_folder.cpp")
61+
list (APPEND WSJCPP_SOURCES "./src/http_handlers/light_web_http_handler_team_logo.h")
62+
list (APPEND WSJCPP_SOURCES "./src/http_handlers/light_web_http_handler_team_logo.cpp")
63+
64+
# scoreboard
65+
list (APPEND WSJCPP_SOURCES "src/scoreboard/scoreboard.cpp")
66+
list (APPEND WSJCPP_SOURCES "src/scoreboard/scoreboard.h")
67+
68+
# storages
69+
list (APPEND WSJCPP_SOURCES "src/storages/storages.h")
70+
list (APPEND WSJCPP_SOURCES "src/storages/storages.cpp")
71+
72+
# file storage
73+
# list (APPEND WSJCPP_SOURCES "src/storages/file/file_storage.h")
74+
# list (APPEND WSJCPP_SOURCES "src/storages/file/file_storage.cpp")
75+
76+
# main
77+
list (APPEND WSJCPP_SOURCES "src/main.cpp")
78+
79+
80+
############################
81+
##### mysql storage
82+
list (APPEND WSJCPP_INCLUDE_DIRS "src/storages/mysql")
83+
list (APPEND WSJCPP_SOURCES "src/storages/mysql/mysql_storage.h")
84+
list (APPEND WSJCPP_SOURCES "src/storages/mysql/mysql_storage.cpp")
85+
86+
# Find and make sure the system have the header file
87+
find_path(MYSQL_HEADER mysql/mysql.h)
88+
if(MYSQL_HEADER STREQUAL "MYSQL_HEADER-NOTFOUND")
89+
message(FATAL_ERROR "Could not find the mysql/mysql.h header file: apt install libmysqlclient-dev")
90+
endif()
91+
92+
include(FindPkgConfig)
93+
pkg_check_modules(LIBMYSQLCLIENT REQUIRED mysqlclient)
94+
95+
foreach(FLAG ${LIBMYSQLCLIENT_CFLAGS_OTHER})
96+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FLAG}")
97+
endforeach()
98+
99+
list (APPEND WSJCPP_INCLUDE_DIRS ${LIBMYSQLCLIENT_LIBRARY_DIRS})
100+
list (APPEND WSJCPP_LIBRARIES ${LIBMYSQLCLIENT_LIBRARIES})
101+
102+
#####
103+
############################
104+
105+
# ZLIB
106+
find_package( ZLIB REQUIRED )
107+
if ( ZLIB_FOUND )
108+
list (APPEND WSJCPP_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS})
109+
include_directories( ${ZLIB_INCLUDE_DIRS} )
110+
list (APPEND WSJCPP_LIBRARIES ${ZLIB_LIBRARIES})
111+
endif( ZLIB_FOUND )
112+
113+
# LIBPNG
114+
find_package(PNG REQUIRED)
115+
if (NOT PNG_FOUND)
116+
message(FATAL_ERROR "You don't seem to have libpng development libraries installed (apt isntall libpng-dev)")
117+
else ()
118+
list (APPEND WSJCPP_INCLUDE_DIRS ${PNG_INCLUDE_DIR})
119+
list (APPEND WSJCPP_LIBRARIES ${PNG_LIBRARY})
120+
endif ()
121+
122+
# CURL
123+
FIND_PACKAGE(CURL)
124+
IF(CURL_FOUND)
125+
list (APPEND WSJCPP_INCLUDE_DIRS ${CURL_INCLUDE_DIR})
126+
list (APPEND WSJCPP_LIBRARIES ${CURL_LIBRARIES})
127+
ELSE(CURL_FOUND)
128+
MESSAGE(FATAL_ERROR "Could not find the CURL library and development files.")
129+
ENDIF(CURL_FOUND)
130+
131+
include_directories(${WSJCPP_INCLUDE_DIRS})
132+
133+
add_executable (ctf01d ${WSJCPP_SOURCES})
134+
135+
target_link_libraries(ctf01d -lpthread ${WSJCPP_LIBRARIES} )
136+
137+
install(
138+
TARGETS
139+
ctf01d
140+
RUNTIME DESTINATION
141+
${CMAKE_INSTALL_PREFIX}/bin
142+
)
143+
144+

Dockerfile

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1-
# LABEL "maintainer"="FreeHackQuest Team <freehackquest@gmail.com>"
2-
# LABEL "repository"="https://github.com/freehackquest/fhq-jury-ad"
3-
41
# stage 0: build binary
5-
FROM freehackquest/debian-10-for-cpp-build:latest
2+
FROM sea5kg/ctf01d-stage-build:v20200903
63

7-
COPY ./fhq-jury-ad /root/sources
8-
WORKDIR /root/sources
4+
COPY ./ /root/
5+
WORKDIR /root/
96
RUN ./clean.sh && ./build_simple.sh
107

11-
# stage 1: finish
12-
FROM freehackquest/debian-10-for-cpp-common:latest
8+
WORKDIR /root/unit-tests.wsjcpp
9+
RUN ./build_simple.sh
10+
RUN ./unit-tests
11+
12+
# stage 1: release
13+
FROM sea5kg/ctf01d-stage-release:v20200903
14+
LABEL "maintainer"="Evgenii Sopov <mrseakg@gmail.com>"
15+
LABEL "repository"="https://github.com/sea-kg/ctf01d"
1316

14-
COPY --from=0 /root/sources/fhq-jury-ad /usr/bin/fhq-jury-ad
15-
COPY ./jury.d /usr/share/fhq-jury-ad/jury.d
17+
RUN mkdir /root/data
18+
COPY --from=0 /root/ctf01d /usr/bin/ctf01d
1619

1720
EXPOSE 8080
18-
CMD ["fhq-jury-ad","-ef","start"]
21+
CMD ["ctf01d","-work-dir","/root/data","start"]

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2018 FreeHackQuest
3+
Copyright (c) 2018 Evgenii Sopov
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

0 commit comments

Comments
 (0)