I want to get a little loading animation as long the Makefile compiles my .o files i saw a loading animation which switched between [|], [/], [-], [] and that is what i wanna implement now.
I tried to achieve that by using printf a Make variable and some ifeq and else ifeq conditions but that didn't worked somehow the if conditions are checked just once after the first call of the
$(OBJDIR)/%.o: rule
what i expect is that the stage of the loading box switches every time the $(OBJDIR)/%.o: rule is called or somehow timebased if there is an easy solution but i think its too complicated so i would stick to the first for now
Also its my first time asking here pls be patient and tell me how to improve my questions
that is the makefile
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: pharbst <pharbst#student.42heilbronn.de +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2022/05/06 09:33:42 by pharbst #+# #+# #
# Updated: 2022/11/29 03:29:26 by pharbst ### ########.fr #
# #
# **************************************************************************** #
SHELL= /bin/bash
Black = $(shell echo -e "\033[0;30m")
FBlack = $(shell echo -e "\033[1;30m")
Red = $(shell echo -e "\033[0;31m")
FRed = $(shell echo -e "\033[1;31m")
Green = $(shell echo -e "\033[0;32m")
FGreen = $(shell echo -e "\033[1;32m")
Brown/Orange = $(shell echo -e "\033[0;33m")
FBrown/Orange = $(shell echo -e "\033[1;33m")
FYellow = $(shell echo -e "\033[1;33m")
Yellow = $(shell echo -e "\033[0;33m")
Blue = $(shell echo -e "\033[0;34m")
FBlue = $(shell echo -e "\033[1;34m")
Purple = $(shell echo -e "\033[0;35m")
FPurple = $(shell echo -e "\033[1;35m")
Cyan = $(shell echo -e "\033[0;36m")
FCyan = $(shell echo -e "\033[1;36m")
FWhite = $(shell echo -e "\033[1;37m")
White = $(shell echo -e "\033[0;37m")
RESET = $(shell echo -e "\033[0m")
TICK = $(shell echo -e "\xE2\x9C\x94")
PRONAME = libftio
NAME = libftio.a
CC = cc
CFLAGS = -Wall -Wextra -Werror -I includes -g
HEADER = ./includes/libftio.h
SRCDIR = ./src
OBJDIR = ./obj
FILES = ft_atoi.c \
ft_bzero.c \
ft_calloc.c \
ft_isalnum.c \
ft_isalpha.c \
ft_isascii.c \
ft_isdigit.c \
ft_isprint.c \
ft_memchr.c \
ft_memcmp.c \
ft_memcpy.c \
ft_memmove.c \
ft_memset.c \
ft_strchr.c \
ft_strlcat.c \
ft_strlcpy.c \
ft_strlen.c \
ft_strncmp.c \
ft_strnstr.c \
ft_strrchr.c \
ft_tolower.c \
ft_toupper.c \
ft_itoa.c \
ft_putchar_fd.c \
ft_putendl_fd.c \
ft_putnbr_fd.c \
ft_putstr_fd.c \
ft_split.c \
ft_strdup.c \
ft_strjoin.c \
ft_strtrim.c \
ft_substr.c \
ft_strmapi.c \
ft_striteri.c \
\
ft_lstnew.c \
ft_lstadd_front.c \
ft_lstsize.c \
ft_lstlast.c \
ft_lstadd_back.c \
ft_lstdelone.c \
ft_lstclear.c \
ft_lstiter.c \
ft_lstmap.c \
\
ft_bufferjoin.c \
ft_buffinit.c \
ft_chartostr.c \
ft_itohex.c \
ft_ptrtohex.c \
ft_strjoinchar.c \
ft_strjoinfree.c \
ft_strlower.c \
ft_strupper.c \
ft_uitoa.c \
ft_printf.c \
ft_printf_helper.c \
get_next_line.c \
ft_strcmp.c \
ft_free_split.c \
OBJS = $(addprefix $(OBJDIR)/, $(FILES:.c=.o))
OBJ_FLAG = 0
all: $(NAME)
$(NAME): header obj_header $(OBJS) linking_header
#ar rcs $(NAME) $(OBJS)
#printf "\b\b\b$(FGreen)[$(TICK)]\n$(RESET)"
$(OBJDIR)/%.o: $(SRCDIR)/*/%.c
#mkdir -p $(OBJDIR)
#$(CC) $(CFLAGS) -o $# -c $<
ifeq ($(OBJ_FLAG), 0)
#printf "\b\b\]"
#OBJ_FLAG=1
else ifeq ($(OBJ_FLAG), 1)
#printf "\b\b|]"
#OBJ_FLAG=2
else ifeq ($(OBJ_FLAG), 2)
#printf "\b\b/]"
#OBJ_FLAG=3
else ifeq ($(OBJ_FLAG), 3)
#printf "\b\b-]"
#OBJ_FLAG=0
endif
clean: header
#echo "$(FRed)Clean $(PRONAME)$(FGreen) [$(TICK)]"
#rm -rf $(OBJS)
#rm -rf $(OBJDIR)
#echo "$(RESET)"
fclean: header
#echo "$(FRed)FCleaning $(PRONAME)$(FGreen) [$(TICK)]"
#rm -rf $(OBJDIR)
#rm -rf $(NAME)
re: fclean all
header:
#echo "$(FBlue)====================$(FYellow)$(PRONAME)$(FBlue)====================$(RESET)"
obj_header:
#printf "$(FBlue)Compiling .o files $(FYellow)[-]"
linking_header:
#printf "\b\b\b$(FGreen)[$(TICK)]\n$(Green)Linking $(PRONAME) $(FYellow)[-]$(RESET)"
git: commit push
commit:
git commit -m "$(msg)"
push:
git push
update:
git pull
.PHONY: all clean fclean re
peter (btw how in the world was this handle not taken prior to 2022?), first off, you really need to go to gnu.org and read the make manual. This is not only recommended but vital if you want to make use of the build language and concepts behind make and its relatives.
Secondly, and this is where I jump ahead of the chapter How make reads a makefile which you should read first, make does not execute the ifeq's in the way you envision: if, ifeq etc. are only used in one first pass when parsing the makefile to decide which parts of the makefile are parsed and which ones are ignored (forever). When make runs over one of its conditionals, it only parses the true-route (if or else branch) and literally throws away all lines from the false-route. This means it is of no use in creating looping constructs or repeated runtime decisions where the various branches are elicited for execution by a dynamic logic predicate. In one word, the ifeq's in your example don't belong to the rule in which they seemingly are embedded but to the file as a whole.
That said, there is one more issue with your perception of make rules: they are executed by calling one extra shell process and therefore a completely fresh set of variables (exceptions: see the manual) per line of a recipe so an assignment like
#OBJ_FLAG=1
is ineffective as the process where this variable exists and has the value 1 lives only for this one line and is deleted immediately afterwards. (See .ONESHELL in the manual for an exemption)
The final upshot of all which I said here is that it is extremely hard to programmatically loop in make in parallel with the recipe execution. This simply never was in the focus of its development which aimed for maximum non-intrusiveness and side-stepping of the make process itself when some recipe process is runnnig. Adorning the build run with interactive elements is left to the user, i.e. to user-supplied programs which also would have to solve the concurrency problems of the 1:n stdout to compilation processes in a parallel make run. Maybe you can draw some inspirations from there: https://unix.stackexchange.com/questions/225179/display-spinner-while-waiting-for-some-process-to-finish
When I am trying to compile the host code using make command. It gave me this error:
`/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
make: *** [bin/host] Error 1
`
Makefile:
ifeq ($(VERBOSE),1)
ECHO :=
else
ECHO := #
endif
# Where is the Intel(R) FPGA SDK for OpenCL(TM) software?
ifeq ($(wildcard $(INTELFPGAOCLSDKROOT)),)
$(error Set INTELFPGAOCLSDKROOT to the root directory of the Intel(R) FPGA SDK for OpenCL(TM) software installation)
endif
ifeq ($(wildcard $(INTELFPGAOCLSDKROOT)/host/include/CL/opencl.h),)
$(error Set INTELFPGAOCLSDKROOT to the root directory of the Intel(R) FPGA SDK for OpenCL(TM) software installation.)
endif
# OpenCL compile and link flags.
AOCL_COMPILE_CONFIG := $(shell aocl compile-config )
AOCL_LINK_CONFIG := $(shell aocl link-config )
# Compilation flags
ifeq ($(DEBUG),1)
CXXFLAGS += -g
else
CXXFLAGS += -O2
endif
# Compiler
CXX := g++
# Target
TARGET := host
TARGET_DIR := bin
# Directories
INC_DIRS := ../common/inc
LIB_DIRS :=
# Files
INCS := $(wildcard )
SRCS := $(wildcard host/src/*.cpp ../common/src/AOCLUtils/*.cpp)
LIBS := rt pthread
# Make it all!
all : $(TARGET_DIR)/$(TARGET)
# Host executable target.
$(TARGET_DIR)/$(TARGET) : Makefile $(SRCS) $(INCS) $(TARGET_DIR)
$(ECHO)$(CXX) $(CPPFLAGS) $(CXXFLAGS) -fPIC $(foreach D,$(INC_DIRS),-I$D) \
$(AOCL_COMPILE_CONFIG) $(SRCS) $(AOCL_LINK_CONFIG) \
$(foreach D,$(LIB_DIRS),-L$D) \
$(foreach L,$(LIBS),-l$L) \
-o $(TARGET_DIR)/$(TARGET)
$(TARGET_DIR) :
$(ECHO)mkdir $(TARGET_DIR)
# Standard make targets
clean :
$(ECHO)rm -f $(TARGET_DIR)/$(TARGET)
.PHONY : all clean
victim#victim:~$ sudo snort -c /etc/snort/snort.conf
--------------------------------------------------
o")~ Snort++ 3.0.0-250
--------------------------------------------------
Loading /etc/snort/snort.conf:
FATAL: can't load /etc/snort/snort.conf: /etc/snort/snort.conf:2: unexpected symbol near '#'
Fatal Error, Quitting..
I have tried previous post but nothing works.
#--------------------------------------------------
# VRT Rule Packages Snort.conf
#
# For more information visit us at:
# http://www.snort.org Snort Website
# http://vrt-sourcefire.blogspot.com/ Sourcefire VRT Blog
#
# Mailing list Contact: snort-sigs#lists.sourceforge.net
# False Positive reports: fp#sourcefire.com
# Snort bugs: bugs#snort.org
#
# Compatible with Snort Versions:
# VERSIONS : 2.9.0.0
#
# Snort build options:
# OPTIONS : --enable-ipv6 --enable-gre --enable-mpls --enable-targetbased --enable-decoder-preprocessor-rules --enable-ppm --enable-perfprofiling --enable-zlib --enable-active-response --enable-normalizer --enable-reload --enable-react --enable-flexresp3
#--------------------------------------------------
###################################################
# This file contains a sample snort configuration.
# You should take the following steps to create your own custom configuration:
#
# 1) Set the network variables.
# 2) Configure the decoder
# 3) Configure the base detection engine
# 4) Configure dynamic loaded libraries
# 5) Configure preprocessors
# 6) Configure output plugins
# 7) Customize your rule set
# 8) Customize preprocessor and decoder rule set
# 9) Customize shared object rule set
###################################################
###################################################
# Step #1: Set the network variables. For more information, see README.variables
###################################################
# Setup the network addresses you are protecting
ipvar HOME_NET any
# Set up the external network addresses. Leave as "any" in most situations
ipvar EXTERNAL_NET any
# List of DNS servers on your network
ipvar DNS_SERVERS $HOME_NET
# List of SMTP servers on your network
ipvar SMTP_SERVERS $HOME_NET
# List of web servers on your network
ipvar HTTP_SERVERS $HOME_NET
# List of sql servers on your network
ipvar SQL_SERVERS $HOME_NET
# List of telnet servers on your network
ipvar TELNET_SERVERS $HOME_NET
# List of ssh servers on your network
ipvar SSH_SERVERS $HOME_NET
# List of ports you run web servers on
portvar HTTP_PORTS [80,311,591,593,901,1220,1414,2301,2381,2809,3128,3702,5250,7777,7779,8000,8008,8028,8080,8088,8118,8123,8180,8243,8280,8888,9090,9091,9443,9999,11371]
# List of ports you want to look for SHELLCODE on.
portvar SHELLCODE_PORTS !80
# List of ports you might see oracle attacks on
portvar ORACLE_PORTS 1024:
# List of ports you want to look for SSH connections on:
portvar SSH_PORTS 22
# other variables, these should not be modified
ipvar AIM_SERVERS [64.12.24.0/23,64.12.28.0/23,64.12.161.0/24,64.12.163.0/24,64.12.200.0/24,205.188.3.0/24,205.188.5.0/24,205.188.7.0/24,205.188.9.0/24,205.188.153.0/24,205.188.179.0/24,205.188.248.0/24]
# Path to your rules files (this can be a relative path)
# Note for Windows users: You are advised to make this an absolute path,
# such as: c:\snort\rules
var RULE_PATH /etc/snort/rules
var SO_RULE_PATH /etc/snort/so_rules
var PREPROC_RULE_PATH /etc/snort/preproc_rules
###################################################
# Step #2: Configure the decoder. For more information, see README.decode
###################################################
# Stop generic decode events:
config disable_decode_alerts
# Stop Alerts on experimental TCP options
config disable_tcpopt_experimental_alerts
# Stop Alerts on obsolete TCP options
config disable_tcpopt_obsolete_alerts
# Stop Alerts on T/TCP alerts
config disable_tcpopt_ttcp_alerts
# Stop Alerts on all other TCPOption type events:
config disable_tcpopt_alerts
# Stop Alerts on invalid ip options
config disable_ipopt_alerts
# Alert if value in length field (IP, TCP, UDP) is greater th elength of the packet
# config enable_decode_oversized_alerts
# Same as above, but drop packet if in Inline mode (requires enable_decode_oversized_alerts)
# config enable_decode_oversized_drops
# Configure IP / TCP checksum mode
config checksum_mode: all
# Configure maximum number of flowbit references. For more information, see README.flowbits
# config flowbits_size: 64
# Configure ports to ignore
# config ignore_ports: tcp 21 6667:6671 1356
# config ignore_ports: udp 1:17 53
# Configure active response for non inline operation. For more information, see REAMDE.active
# config response: eth0 attempts 2
###################################################
# Step #3: Configure the base detection engine. For more information, see README.decode
###################################################
# Configure PCRE match limitations
config pcre_match_limit: 3500
config pcre_match_limit_recursion: 1500
# Configure the detection engine See the Snort Manual, Configuring Snort - Includes - Config
config detection: search-method ac-split search-optimize max-pattern-len 20
# Configure the event queue. For more information, see README.event_queue
config event_queue: max_queue 8 log 3 order_events content_length
###################################################
# Per packet and rule latency enforcement
# For more information see README.ppm
###################################################
# Per Packet latency configuration
#config ppm: max-pkt-time 250, \
# fastpath-expensive-packets, \
# pkt-log
# Per Rule latency configuration
#config ppm: max-rule-time 200, \
# threshold 3, \
# suspend-expensive-rules, \
# suspend-timeout 20, \
# rule-log alert
###################################################
# Configure Perf Profiling for debugging
# For more information see README.PerfProfiling
###################################################
#config profile_rules: print all, sort avg_ticks
#config profile_preprocs: print all, sort avg_ticks
###################################################
# Step #4: Configure dynamic loaded libraries.
# For more information, see Snort Manual, Configuring Snort - Dynamic Modules
###################################################
# path to dynamic preprocessor libraries
dynamicpreprocessor directory /usr/local/lib/snort_dynamicpreprocessor/
# path to base preprocessor engine
dynamicengine /usr/local/lib/snort_dynamicengine/libsf_engine.so
# path to dynamic rules libraries
dynamicdetection directory /usr/local/lib/snort_dynamicrules
###################################################
# Step #5: Configure preprocessors
# For more information, see the Snort Manual, Configuring Snort - Preprocessors
###################################################
# Inline packet normalization. For more information, see README.normalize
# Does nothing in IDS mode
preprocessor normalize_ip4
preprocessor normalize_tcp: ips ecn stream
preprocessor normalize_icmp4
preprocessor normalize_ip6
preprocessor normalize_icmp6
# Target-based IP defragmentation. For more inforation, see README.frag3
preprocessor frag3_global: max_frags 65536
preprocessor frag3_engine: policy windows detect_anomalies overlap_limit 10 min_fragment_length 100 timeout 180
# Target-Based stateful inspection/stream reassembly. For more inforation, see README.stream5
preprocessor stream5_global: max_tcp 8192, track_tcp yes, track_udp yes, track_icmp no max_active_responses 2 min_response_seconds 5
preprocessor stream5_tcp: policy windows, detect_anomalies, require_3whs 180, \
overlap_limit 10, small_segments 3 bytes 150, timeout 180, \
ports client 21 22 23 25 42 53 79 109 110 111 113 119 135 136 137 139 143 \
161 445 513 514 587 593 691 1433 1521 2100 3306 6665 6666 6667 6668 6669 \
7000 32770 32771 32772 32773 32774 32775 32776 32777 32778 32779, \
ports both 80 311 443 465 563 591 593 636 901 989 992 993 994 995 1220 1414 2301 2381 2809 3128 3702 5250 6907 7702 7777 7779 \
7801 7900 7901 7902 7903 7904 7905 7906 7908 7909 7910 7911 7912 7913 7914 7915 7916 \
7917 7918 7919 7920 8000 8008 8028 8080 8088 8118 8123 8180 8243 8280 8888 9090 9091 9443 9999 11371
preprocessor stream5_udp: timeout 180
# performance statistics. For more information, see the Snort Manual, Configuring Snort - Preprocessors - Performance Monitor
# preprocessor perfmonitor: time 300 file /var/snort/snort.stats pktcnt 10000
# HTTP normalization and anomaly detection. For more information, see README.http_inspect
preprocessor http_inspect: global iis_unicode_map unicode.map 1252 compress_depth 20480 decompress_depth 20480
preprocessor http_inspect_server: server default \
chunk_length 500000 \
server_flow_depth 0 \
client_flow_depth 0 \
post_depth 65495 \
oversize_dir_length 500 \
max_header_length 750 \
max_headers 100 \
ports { 80 311 591 593 901 1220 1414 2301 2381 2809 3128 3702 5250 7777 7779 8000 8008 8028 8080 8088 8118 8123 8180 8243 8280 8888 9090 9091 9443 9999 11371 } \
non_rfc_char { 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 } \
enable_cookie \
extended_response_inspection \
inspect_gzip \
normalize_utf \
unlimited_decompress \
apache_whitespace no \
ascii no \
bare_byte no \
base36 no \
directory no \
double_decode no \
iis_backslash no \
iis_delimiter no \
iis_unicode no \
multi_slash no \
utf_8 no \
u_encode yes \
webroot no
# ONC-RPC normalization and anomaly detection. For more information, see the Snort Manual, Configuring Snort - Preprocessors - RPC Decode
preprocessor rpc_decode: 111 32770 32771 32772 32773 32774 32775 32776 32777 32778 32779 no_alert_multiple_requests no_alert_large_fragments no_alert_incomplete
# Back Orifice detection.
preprocessor bo
# FTP / Telnet normalization and anomaly detection. For more information, see README.ftptelnet
preprocessor ftp_telnet: global inspection_type stateful encrypted_traffic no
preprocessor ftp_telnet_protocol: telnet \
ayt_attack_thresh 20 \
normalize ports { 23 } \
detect_anomalies
preprocessor ftp_telnet_protocol: ftp server default \
def_max_param_len 100 \
ports { 21 2100 3535 } \
telnet_cmds yes \
ignore_telnet_erase_cmds yes \
ftp_cmds { ABOR ACCT ADAT ALLO APPE AUTH CCC CDUP } \
ftp_cmds { CEL CLNT CMD CONF CWD DELE ENC EPRT } \
ftp_cmds { EPSV ESTA ESTP FEAT HELP LANG LIST LPRT } \
ftp_cmds { LPSV MACB MAIL MDTM MIC MKD MLSD MLST } \
ftp_cmds { MODE NLST NOOP OPTS PASS PASV PBSZ PORT } \
ftp_cmds { PROT PWD QUIT REIN REST RETR RMD RNFR } \
ftp_cmds { RNTO SDUP SITE SIZE SMNT STAT STOR STOU } \
ftp_cmds { STRU SYST TEST TYPE USER XCUP XCRC XCWD } \
ftp_cmds { XMAS XMD5 XMKD XPWD XRCP XRMD XRSQ XSEM } \
ftp_cmds { XSEN XSHA1 XSHA256 } \
alt_max_param_len 0 { ABOR CCC CDUP ESTA FEAT LPSV NOOP PASV PWD QUIT REIN STOU SYST XCUP XPWD } \
alt_max_param_len 200 { ALLO APPE CMD HELP NLST RETR RNFR STOR STOU XMKD } \
alt_max_param_len 256 { CWD RNTO } \
alt_max_param_len 400 { PORT } \
alt_max_param_len 512 { SIZE } \
chk_str_fmt { ACCT ADAT ALLO APPE AUTH CEL CLNT CMD } \
chk_str_fmt { CONF CWD DELE ENC EPRT EPSV ESTP HELP } \
chk_str_fmt { LANG LIST LPRT MACB MAIL MDTM MIC MKD } \
chk_str_fmt { MLSD MLST MODE NLST OPTS PASS PBSZ PORT } \
chk_str_fmt { PROT REST RETR RMD RNFR RNTO SDUP SITE } \
chk_str_fmt { SIZE SMNT STAT STOR STRU TEST TYPE USER } \
chk_str_fmt { XCRC XCWD XMAS XMD5 XMKD XRCP XRMD XRSQ } \
chk_str_fmt { XSEM XSEN XSHA1 XSHA256 } \
cmd_validity ALLO < int [ char R int ] > \
cmd_validity EPSV < { char 12|string } > \
cmd_validity MACB < string > \
cmd_validity MDTM < [ date nnnnnnnnnnnnnn[.n[n[n]]] ] string > \
cmd_validity MODE < char ASBCZ > \
cmd_validity PORT < host_port > \
cmd_validity PROT < char CSEP > \
cmd_validity STRU < char FRPO [ string ] > \
cmd_validity TYPE < { char AE [ char NTC ] | char I | char L [ number ] } >
preprocessor ftp_telnet_protocol: ftp client default \
max_resp_len 256 \
bounce yes \
ignore_telnet_erase_cmds yes \
telnet_cmds yes
# SMTP normalization and anomaly detection. For more information, see README.SMTP
preprocessor smtp: ports { 25 465 587 691 } \
inspection_type stateful \
enable_mime_decoding \
max_mime_depth 20480 \
normalize cmds \
normalize_cmds { ATRN AUTH BDAT CHUNKING DATA DEBUG EHLO EMAL ESAM ESND ESOM ETRN EVFY } \
normalize_cmds { EXPN HELO HELP IDENT MAIL NOOP ONEX QUEU QUIT RCPT RSET SAML SEND SOML } \
normalize_cmds { STARTTLS TICK TIME TURN TURNME VERB VRFY X-ADAT X-DRCP X-ERCP X-EXCH50 } \
normalize_cmds { X-EXPS X-LINK2STATE XADR XAUTH XCIR XEXCH50 XGEN XLICENSE XQUE XSTA XTRN XUSR } \
max_command_line_len 512 \
max_header_line_len 1000 \
max_response_line_len 512 \
alt_max_command_line_len 260 { MAIL } \
alt_max_command_line_len 300 { RCPT } \
alt_max_command_line_len 500 { HELP HELO ETRN EHLO } \
alt_max_command_line_len 255 { EXPN VRFY ATRN SIZE BDAT DEBUG EMAL ESAM ESND ESOM EVFY IDENT NOOP RSET } \
alt_max_command_line_len 246 { SEND SAML SOML AUTH TURN ETRN DATA RSET QUIT ONEX QUEU STARTTLS TICK TIME TURNME VERB X-EXPS X-LINK2STATE XADR XAUTH XCIR XEXCH50 XGEN XLICENSE XQUE XSTA XTRN XUSR } \
valid_cmds { ATRN AUTH BDAT CHUNKING DATA DEBUG EHLO EMAL ESAM ESND ESOM ETRN EVFY } \
valid_cmds { EXPN HELO HELP IDENT MAIL NOOP ONEX QUEU QUIT RCPT RSET SAML SEND SOML } \
valid_cmds { STARTTLS TICK TIME TURN TURNME VERB VRFY X-ADAT X-DRCP X-ERCP X-EXCH50 } \
valid_cmds { X-EXPS X-LINK2STATE XADR XAUTH XCIR XEXCH50 XGEN XLICENSE XQUE XSTA XTRN XUSR } \
xlink2state { enabled }
# Portscan detection. For more information, see README.sfportscan
# preprocessor sfportscan: proto { all } memcap { 10000000 } sense_level { low }
# ARP spoof detection. For more information, see the Snort Manual - Configuring Snort - Preprocessors - ARP Spoof Preprocessor
# preprocessor arpspoof
# preprocessor arpspoof_detect_host: 192.168.40.1 f0:0f:00:f0:0f:00
# SSH anomaly detection. For more information, see README.ssh
preprocessor ssh: server_ports { 22 } \
autodetect \
max_client_bytes 19600 \
max_encrypted_packets 20 \
max_server_version_len 100 \
enable_respoverflow enable_ssh1crc32 \
enable_srvoverflow enable_protomismatch
# SMB / DCE-RPC normalization and anomaly detection. For more information, see README.dcerpc2
preprocessor dcerpc2: memcap 102400, events [co ]
preprocessor dcerpc2_server: default, policy WinXP, \
detect [smb [139,445], tcp 135, udp 135, rpc-over-http-server 593], \
autodetect [tcp 1025:, udp 1025:, rpc-over-http-server 1025:], \
smb_max_chain 3
# DNS anomaly detection. For more information, see README.dns
preprocessor dns: ports { 53 } enable_rdata_overflow
# SSL anomaly detection and traffic bypass. For more information, see README.ssl
preprocessor ssl: ports { 443 465 563 636 989 992 993 994 995 7801 7702 7900 7901 7902 7903 7904 7905 7906 6907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 }, trustservers, noinspect_encrypted
# SDF sensitive data preprocessor. For more information see README.sensitive_data
preprocessor sensitive_data: alert_threshold 25
###################################################
# Step #6: Configure output plugins
# For more information, see Snort Manual, Configuring Snort - Output Modules
###################################################
# unified2
# Recommended for most installs
# output unified2: filename merged.log, limit 128, nostamp, mpls_event_types, vlan_event_types
# Additional configuration for specific types of installs
# output alert_unified2: filename snort.alert, limit 128, nostamp
# output log_unified2: filename snort.log, limit 128, nostamp
# syslog
# output alert_syslog: LOG_AUTH LOG_ALERT
# pcap
# output log_tcpdump: tcpdump.log
# database
# output database: alert, <db_type>, user=<username> password=<password> test dbname=<name> host=<hostname>
# output database: log, <db_type>, user=<username> password=<password> test dbname=<name> host=<hostname>
# prelude
# output alert_prelude
# metadata reference data. do not modify these lines
include classification.config
include reference.config
###################################################
# Step #7: Customize your rule set
# For more information, see Snort Manual, Writing Snort Rules
#
# NOTE: All categories are enabled in this conf file
###################################################
# site specific rules
include $RULE_PATH/local.rules
include $RULE_PATH/attack-responses.rules
include $RULE_PATH/backdoor.rules
include $RULE_PATH/bad-traffic.rules
include $RULE_PATH/blacklist.rules
include $RULE_PATH/botnet-cnc.rules
include $RULE_PATH/chat.rules
include $RULE_PATH/content-replace.rules
include $RULE_PATH/ddos.rules
include $RULE_PATH/dns.rules
include $RULE_PATH/dos.rules
include $RULE_PATH/exploit.rules
include $RULE_PATH/finger.rules
include $RULE_PATH/ftp.rules
include $RULE_PATH/icmp.rules
include $RULE_PATH/icmp-info.rules
include $RULE_PATH/imap.rules
include $RULE_PATH/info.rules
include $RULE_PATH/misc.rules
include $RULE_PATH/multimedia.rules
include $RULE_PATH/mysql.rules
include $RULE_PATH/netbios.rules
include $RULE_PATH/nntp.rules
include $RULE_PATH/oracle.rules
include $RULE_PATH/other-ids.rules
include $RULE_PATH/p2p.rules
include $RULE_PATH/phishing-spam.rules
include $RULE_PATH/policy.rules
include $RULE_PATH/pop2.rules
include $RULE_PATH/pop3.rules
include $RULE_PATH/rpc.rules
include $RULE_PATH/rservices.rules
include $RULE_PATH/scada.rules
include $RULE_PATH/scan.rules
include $RULE_PATH/shellcode.rules
include $RULE_PATH/smtp.rules
include $RULE_PATH/snmp.rules
include $RULE_PATH/specific-threats.rules
include $RULE_PATH/spyware-put.rules
include $RULE_PATH/sql.rules
include $RULE_PATH/telnet.rules
include $RULE_PATH/tftp.rules
include $RULE_PATH/virus.rules
include $RULE_PATH/voip.rules
include $RULE_PATH/web-activex.rules
include $RULE_PATH/web-attacks.rules
include $RULE_PATH/web-cgi.rules
include $RULE_PATH/web-client.rules
include $RULE_PATH/web-coldfusion.rules
include $RULE_PATH/web-frontpage.rules
include $RULE_PATH/web-iis.rules
include $RULE_PATH/web-misc.rules
include $RULE_PATH/web-php.rules
include $RULE_PATH/x11.rules
###################################################
# Step #8: Customize your preprocessor and decoder alerts
# For more information, see README.decoder_preproc_rules
###################################################
# decoder and preprocessor event rules
# include $PREPROC_RULE_PATH/preprocessor.rules
# include $PREPROC_RULE_PATH/decoder.rules
# include $PREPROC_RULE_PATH/sensitive-data.rules
###################################################
# Step #9: Customize your Shared Object Snort Rules
# For more information, see http://vrt-sourcefire.blogspot.com/2009/01/using-vrt-certified-shared-object-rules.html
###################################################
# dynamic library rules
# include $SO_RULE_PATH/bad-traffic.rules
# include $SO_RULE_PATH/chat.rules
# include $SO_RULE_PATH/dos.rules
# include $SO_RULE_PATH/exploit.rules
# include $SO_RULE_PATH/icmp.rules
# include $SO_RULE_PATH/imap.rules
# include $SO_RULE_PATH/misc.rules
# include $SO_RULE_PATH/multimedia.rules
# include $SO_RULE_PATH/netbios.rules
# include $SO_RULE_PATH/nntp.rules
# include $SO_RULE_PATH/p2p.rules
# include $SO_RULE_PATH/smtp.rules
# include $SO_RULE_PATH/sql.rules
# include $SO_RULE_PATH/web-activex.rules
# include $SO_RULE_PATH/web-client.rules
# include $SO_RULE_PATH/web-iis.rules
# include $SO_RULE_PATH/web-misc.rules
# Event thresholding or suppression commands. See threshold.conf
include threshold.conf
you are try to use snort file version 2 in snort version 3, change
Is there any Bash or Python regular expression for below C pre processor line marker ?
C Pre Processor output line markers as follows:
# 74 "a/b/some_file.c" 3 4
First comes the symbol - #
space
then line number - 74
space
then - "file path"
space
then Zero or more integers separated by space - 3 4
More info on:
https://gcc.gnu.org/onlinedocs/gcc-6.4.0/cpp/Preprocessor-Output.html
I dunno where you'd want Bash to match such lines, and Python undoubtedly could do it with its regexes. I have a sed script which I use to convert #line directives into comments (which can sometimes make debugging preprocessed code easier). It looks like this:
#!/bin/sh
#
# #(#)$Id: linecomments.sh,v 1.3 2018/01/05 05:12:10 jleffler Exp $
#
# Convert #line directives into comments
# Deals with four forms of the #line directive:
# # line 99 "file"
# # line 99
# # 99 "file"
# # 99
exec sed \
-e 's%^[[:space:]]*#[[:space:]]*line[[:space:]][0-9][0-9]*[[:space:]].*%/*&*/%' \
-e 's%^[[:space:]]*#[[:space:]]*[0-9][0-9]*[[:space:]].*%/*&*/%' \
-e 's%^[[:space:]]*#[[:space:]]*line[[:space:]][0-9][0-9]*$%/*&*/%' \
-e 's%^[[:space:]]*#[[:space:]]*[0-9][0-9]*$%/*&*/%' \
"$#"
I use % to delimit the regular expressions since I need /* and */ in the replacement text. The regexes match 'trailing junk' such as the extra numbers emitted by GCC.
The edit in 2018 replaced fragments that looked like [ ] with [[:space:]] — the old code (dated 2001) used a blank and a tab in each case. This is clearer; you can copy'n'paste without having to worry about where there are tabs.
I am trying to build a model written in F90. I keep having problems with it especially in the linking phase. I tried to compile both with gfortran and with ifort but both of them are complaining about undefined symbols. Here are the errors from ifort (gfortran has very similar ones) after the compilation which works fine
ar rs /Users/manfredo/Desktop/ED2/ED/build//ed_2.1-opt.a allometry.o an_header.o average_utils.o bdf2_solver.o budget_utils.o canopy_air_coms.o canopy_layer_coms.o canopy_radiation_coms.o canopy_struct_dynamics.o c34constants.o charutils.o consts_coms.o dateutils.o decomp_coms.o detailed_coms.o disturbance.o disturb_coms.o edio.o ed_1st.o ed_bigleaf_init.o ed_driver.o ed_filelist.o ed_grid.o ed_init.o ed_init_atm.o ed_init_full_history.o ed_load_namelist.o ed_max_dims.o ed_mem_alloc.o ed_mem_grid_dim_defs.o ed_met_driver.o ed_misc_coms.o ed_model.o ed_mpass_init.o ed_nbg_init.o ed_node_coms.o ed_opspec.o ed_params.o ed_para_coms.o ed_para_init.o ed_print.o ed_read_ed10_20_history.o ed_read_ed21_history.o ed_state_vars.o ed_therm_lib.o ed_type_init.o ed_var_tables.o ed_work_vars.o ed_xml_config.o ename_coms.o euler_driver.o events.o farq_leuning.o fatal_error.o fire.o forestry.o fusion_fission_coms.o fuse_fiss_utils.o great_circle.o grid_coms.o growth_balive.o h5_output.o hdf5_coms.o hdf5_utils.o heun_driver.o hybrid_driver.o hydrology_coms.o hydrology_constants.o init_hydro_sites.o invmondays.o landuse_init.o lapse.o leaf_database.o libxml2f90.f90_pp.o lsm_hyd.o mem_polygons.o met_driver_coms.o mortality.o multiple_scatter.o numutils.o old_twostream_rad.o optimiz_coms.o phenology_aux.o phenology_coms.o phenology_driv.o phenology_startup.o photosyn_driv.o physiology_coms.o pft_coms.o radiate_driver.o radiate_utils.o reproduction.o rk4_coms.o rk4_derivs.o rk4_driver.o rk4_integ_utils.o rk4_misc.o rk4_stepper.o rsys.o soil_coms.o soil_respiration.o stable_cohorts.o structural_growth.o therm_lib.o therm_lib8.o twostream_rad.o update_derived_props.o utils_c.o utils_f.o vegetation_dynamics.o
cp -f /Users/manfredo/Desktop/ED2/ED/src/driver/edmain.F90 edmain.F90
ifort -c -DUSE_INTERF=1 -DUSENC=0 -DMAC_OS_X -DUSE_HDF5=1 -DUSE_COLLECTIVE_MPIO=0 -DUSE_MPIWTIME=0 -O0 -gen-interfaces -I/usr/include/malloc -I/Users/manfredo/Desktop/ED2/ED/src/include -I/usr/local/hdf5_mio/include edmain.F90
rm -f edmain.F90
ifort -o /Users/manfredo/Desktop/ED2/ED/build/ed_2.1-opt edmain.o -I/usr/local/hdf5_mio/include/Users/manfredo/Desktop/ED2/ED/build/ed_2.1-opt.a -lm -lz -L/usr/local/hdf5_mio/lib -lhdf5 -lhdf5_fortran -lhdf5_hl
ifort version 14.0.4
ld: warning: path '/dev/null' following -L not a directory
Undefined symbols for architecture x86_64:
"_decomp_coms_mp_cwd_frac_", referenced from:
_init_decomp_params_ in ed_2.1-opt.a(ed_params.o)
_update_polygon_derived_props_ in ed_2.1-opt.a(update_derived_props.o)
_read_ed_xml_config_ in ed_2.1-opt.a(ed_xml_config.o)
_write_ed_xml_config_ in ed_2.1-opt.a(ed_xml_config.o)
_resp_rh_ in ed_2.1-opt.a(soil_respiration.o)
"_decomp_coms_mp_decay_rate_fsc_", referenced from:
_init_decomp_params_ in ed_2.1-opt.a(ed_params.o)
_read_ed_xml_config_ in ed_2.1-opt.a(ed_xml_config.o)
_write_ed_xml_config_ in ed_2.1-opt.a(ed_xml_config.o)
_resp_rh_ in ed_2.1-opt.a(soil_respiration.o)
_update_c_and_n_pools_ in ed_2.1-opt.a(soil_respiration.o)
another bunch of similar errors
ld: symbol(s) not found for architecture x86_64
make[1]: *** [/Users/manfredo/Desktop/ED2/ED/build//ed_2.1-opt] Error 1
make: *** [all] Error 2
file ed_params.f90 reads
subroutine init_decomp_params()
use decomp_coms , only : n_decomp_lim
decomp_coms.f90 is a module file.
This is the important part of the Makefile
#----- Define path and compilation --------------------------------------------------------#
include paths.mk
include include.mk.$(OPT)
#------------------------------------------------------------------------------------------#
#------------------------------------------------------------------------------------------#
# Double check that the "LOWO" flags have been set. In case they have not, clone the #
# standard options. LOWO stands for LOWer Optimisation, and these flags are used for a #
# subroutines that are taking several hours to compile with ifort-13 (ed_state_vars.f90 #
# and a few others). #
#------------------------------------------------------------------------------------------#
ifeq ($(F_LOWO_OPTS),)
F_LOWO_OPTS = $(F_OPTS)
endif
#------------------------------------------------------------------------------------------#
#----- Compiler commands. -----------------------------------------------------------------#
INCLUDES = $(PAR_INCS) -I$(ED_INCS) $(HDF5_INCS) $(MPI_INCS)
F90_COMMAND = $(F_COMP) -c $(F_OPTS) $(INCLUDES) $(PAR_DEFS)
F90_LOWO_COMMAND = $(F_COMP) -c $(F_LOWO_OPTS) $(INCLUDES) $(PAR_DEFS)
FPP_COMMAND = $(F_COMP) -c -DUSE_INTERF=$(USE_INTERF) -DUSENC=$(USENC) -D$(CMACH) \
-DUSE_HDF5=$(USE_HDF5) -DUSE_COLLECTIVE_MPIO=$(USE_COLLECTIVE_MPIO) \
-DUSE_MPIWTIME=$(USE_MPIWTIME) $(F_OPTS) $(INCLUDES) $(PAR_DEFS)
FPP_LOWO_COMMAND = $(F_COMP) -c -DUSE_INTERF=$(USE_INTERF) -DUSENC=$(USENC) -D$(CMACH) \
-DUSE_HDF5=$(USE_HDF5) -DUSE_COLLECTIVE_MPIO=$(USE_COLLECTIVE_MPIO) \
-DUSE_MPIWTIME=$(USE_MPIWTIME) $(F_LOWO_OPTS) $(INCLUDES) $(PAR_DEFS)
CXX_COMMAND = $(C_COMP) -c $(C_OPTS) -D$(CMACH) $(HDF5_INCS) $(INCLUDES) $(PAR_DEFS)
#------------------------------------------------------------------------------------------#
#----- Define archive and executable names. -----------------------------------------------#
EXE=$(BASE)/ed_$(ED_VERSION)-$(OPT)
LIBMODEL=$(BASE)/ed_$(ED_VERSION)-$(OPT).a
#------------------------------------------------------------------------------------------#
include objects.mk
#----- Define targets. --------------------------------------------------------------------#
all:
make gendep
make $(EXE)
make $(EXE)
make $(EXE)
make $(EXE)
make $(EXE)
gendep:
#echo ""
./generate_deps.sh $(ED_ROOT)
#echo === Finished dependencies ===
$(EXE): $(LIBMODEL) $(MAINOBJ)
#echo ""
$(LOADER) -o $(EXE) edmain.o $(LOADER_OPTS) $(INCLUDES) $(LIBMODEL) $(HDF5_LIBS) \
$(PAR_LIBS) $(NC_LIBS) $(LIBS) $(LOADER_OPTS)
#echo ""
#echo Finished building === $(EXE)
#echo ""
$(MAINOBJ): $(MAIN)
#echo ""
cp -f $< $(<F:.F90=.F90)
$(FPP_COMMAND) $(<F:.F90=.F90)
rm -f $(<F:.F90=.F90)
$(LIBMODEL): $(OBJ_MODEL)
$(ARCHIVE) $(LIBMODEL) $(OBJ_MODEL)
which includes the following file (objects.mk)
#Makefile objects_edofl.mk
# Define main source.
MAIN = $(ED_DRIVER)/edmain.F90
MAINOBJ = edmain.o
# Define objects.
OBJ_MODEL = \
allometry.o \
an_header.o \
average_utils.o \
bdf2_solver.o \
budget_utils.o \
canopy_air_coms.o \
canopy_layer_coms.o \
canopy_radiation_coms.o \
canopy_struct_dynamics.o \
c34constants.o \
charutils.o \
consts_coms.o \
dateutils.o \
decomp_coms.o \
detailed_coms.o \
disturbance.o \
other_objects
and this other file (include.mk.opt.macosx)
MAKE=/usr/bin/make
# libraries.
BASE=$(ED_ROOT)/build/
# Activate appropriate parts below, comment out others.
# HDF 5 Libraries
# ED2 HAS OPTIONAL HDF 5 I/O
# If you wish to use this functionality specify USE_HDF5=1
# and specify the location of the include directory
# library files. Make sure you include the zlib.a location too.
USE_HDF5=1
HDF5_INCS=-I/usr/local/hdf5_mio/include
HDF5_LIBS=-lm -lz -L/usr/local/hdf5_mio/lib -lhdf5 -lhdf5_fortran -lhdf5_hl
#---------------------------------------------------------------
# If you have a version of hdf5 compiled in parallel, then you
# may benefit from collective I/O, then use this flag = 1
# Otherwise, set it to zero.
USE_COLLECTIVE_MPIO=0
#---------------------------------------------------------------
# netCDF libraries ---------------------------------------------
# If you have netCDF set USENC=1 and type the lib folder
# at NC_LIBS, with the leading -L (e.g. -L/usr/local/lib).
# If you don't have it, leave USENC=0 and type a dummy
# folder for NC_LIBS (e.g. -L/dev/null or leave it blank)
USENC=0
NC_LIBS=-L/dev/null
# --------------------------------------------------------------
# interface ----------------------------------------------------
# This should be 1 unless you are running with -gen-interfaces.
# Interfaces usually make the compilation to crash when the
# -gen-interfaces option are on, so this flag bypass all
# interfaces in the code.
USE_INTERF=1
# MPI_Wtime. ---------------------------------------------------
# If USE_MPIWTIME=1, then it will use MPI libraries to compute
# the wall time (the only double-precision intrinsic). In case
# you don't have it, leave USE_MPIWTIME=0, in which case it will
# use a simpler, single-precision function.
USE_MPIWTIME=0
#----------------- MAC_OS_X (Leopard) ---- gfortran/gcc ---------------
CMACH=MAC_OS_X
F_COMP=ifort
C_COMP=icc
LOADER=ifort
MOD_EXT=mod
##################################### COMPILER OPTIONS #####################################
#------------------------------------------------------------------------------------------#
# A. Pickiest - Use this whenever you change arguments on functions and subroutines. #
# This will perform the same tests as B but it will also check whether all #
# arguments match between subroutine declaration and subroutine calls. #
# WARNING: In order to really check all interfaces you must compile with #
# this option twice: #
# 1. Compile (./compile.sh) #
# 2. Prepare second compilation(./2ndcomp.sh) #
# 3. Compile one more time (./compile.sh) #
# If the compilation fails either at step 1 or 3, then your code has inter- #
# face problems. If it successfully compiles, then you can switch to B. #
#------------------------------------------------------------------------------------------#
#USE_INTERF=0
#F_OPTS=-O0 -Wall -ffpe-trap=invalid,zero,overflow,underflow,precision,denormal \
# -ffree-line-length-none
#C_OPTS=-O0 -DUNDERSCORE -DLITTLE
#LOADER_OPTS=-O0 -ffree-line-length-none
#------------------------------------------------------------------------------------------#
# E. Fast - This is all about performance, use only when you are sure that the model has #
# no code problem, and you want results asap. This will not check for any #
# problems, which means that this is an option suitable for end users, not de- #
# velopers. #
#------------------------------------------------------------------------------------------#
USE_INTERF=1
F_OPTS= -O0 -v
C_OPTS= -DLITTLE -v
F_LOWO_OPTS= -O0
LOADER_OPTS= -ffixed-line-length-none
#------------------------------------------------------------------------------------------#
#---------------If using scritps 'mpicc' e 'mpif90'---------------'
MPI_PATH=
PAR_INCS=-I/usr/include/malloc
PAR_LIBS=
PAR_DEFS=
#-----------------------------------------------------------------
# For IBM,HP,SGI,ALPHA,LINUX use these:
ARCHIVE=ar rs
# For NEC SX-6
#ARCHIVE=sxar rs
# For SUN,CONVEX
#ARCHIVE=ar r'
When looking at the source files these errors kind of make sense because most of the subroutines are declared without explicit interfaces, that is without a module and a corresponding use statement.
The problem is that the package encompasses hundreds of files and going through all of them to change the interfaces is not feasible. Moreover the same package can be built on other platforms/compilers.
Thus my question is, is it possible to give the compiler options that enable the correct linking even if most of the subroutines don't have explicit interface.
Thanks for help