]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
6 years agostream: minor test cleanups 3739/head
Victor Julien [Thu, 21 Mar 2019 13:22:04 +0000 (14:22 +0100)] 
stream: minor test cleanups

6 years agompm: track maxdepth
Victor Julien [Tue, 19 Mar 2019 10:41:41 +0000 (11:41 +0100)] 
mpm: track maxdepth

Track max depth setting per MpmCtx.

To make sure the data structure doesn't increase in size change global
bool to use a flags field.

6 years agodetect/flow: optimize flow check
Victor Julien [Sun, 17 Mar 2019 18:29:45 +0000 (19:29 +0100)] 
detect/flow: optimize flow check

Flow direction doesn't need explicit checking as the rule groups (sgh)
are already per direction. So if a rule sets only flow:to_server or
flow:to_client, we can avoid adding a sigmatch to the signature.

6 years agodetect/tag: minor code cleanup
Victor Julien [Sat, 16 Mar 2019 07:11:42 +0000 (08:11 +0100)] 
detect/tag: minor code cleanup

6 years agodetect/mark: use postmatch instead of tag list
Victor Julien [Sat, 16 Mar 2019 07:07:14 +0000 (08:07 +0100)] 
detect/mark: use postmatch instead of tag list

Keep the tag list for just tags. Post match list is better so the
keyword also works with pass and noalert rules.

6 years agodetect/mark: minor code cleanups
Victor Julien [Sat, 16 Mar 2019 07:05:17 +0000 (08:05 +0100)] 
detect/mark: minor code cleanups

6 years agodetect: packet match micro optimization
Victor Julien [Sat, 16 Mar 2019 06:34:40 +0000 (07:34 +0100)] 
detect: packet match micro optimization

6 years agodetect/filestore: use postmatch callback
Victor Julien [Fri, 15 Mar 2019 20:41:49 +0000 (21:41 +0100)] 
detect/filestore: use postmatch callback

6 years agodetect/replace: implement post-match
Victor Julien [Fri, 15 Mar 2019 19:05:32 +0000 (20:05 +0100)] 
detect/replace: implement post-match

Implement replace executor as a post match callback so that it
is only considered if there actually is a replace keyword in use.

6 years agoeve/flow/netflow: log correct tulpe on reversed flows
Victor Julien [Fri, 3 Aug 2018 12:14:05 +0000 (14:14 +0200)] 
eve/flow/netflow: log correct tulpe on reversed flows

6 years agostream: use flow/packet swap logic for SYN/ACK midstream
Victor Julien [Fri, 3 Aug 2018 10:12:43 +0000 (12:12 +0200)] 
stream: use flow/packet swap logic for SYN/ACK midstream

6 years agoflow: on timeout, consider reverse flows for pseudo packets
Victor Julien [Wed, 20 Mar 2019 15:38:56 +0000 (16:38 +0100)] 
flow: on timeout, consider reverse flows for pseudo packets

6 years agoflow: introduce flow swap support
Victor Julien [Fri, 3 Aug 2018 09:10:26 +0000 (11:10 +0200)] 
flow: introduce flow swap support

6 years agocommon: introduce flags and var swapping macros
Victor Julien [Fri, 27 Jul 2018 12:16:41 +0000 (14:16 +0200)] 
common: introduce flags and var swapping macros

6 years agopacket: add 'swap' function to reverse direction
Victor Julien [Fri, 27 Jul 2018 10:24:20 +0000 (12:24 +0200)] 
packet: add 'swap' function to reverse direction

6 years agodetect/flow: don't require flow for direction options
Victor Julien [Mon, 30 Jul 2018 19:01:05 +0000 (21:01 +0200)] 
detect/flow: don't require flow for direction options

Flow isn't directly used for direction checks, so don't require
a flow to be present.

6 years agodetect/parse: improve direction setting on sigs
Victor Julien [Tue, 31 Jul 2018 07:14:26 +0000 (09:14 +0200)] 
detect/parse: improve direction setting on sigs

Only set both directions if no direction has been explicitly set before.

6 years agodetect/bytetest: debug cleanup
Victor Julien [Tue, 12 Mar 2019 18:55:34 +0000 (19:55 +0100)] 
detect/bytetest: debug cleanup

6 years agoapp-layer/pd: free memory
Victor Julien [Thu, 21 Mar 2019 11:06:07 +0000 (12:06 +0100)] 
app-layer/pd: free memory

6 years agodetect: remove BUG_ON from packet path 3735/head
Victor Julien [Mon, 18 Mar 2019 09:35:45 +0000 (10:35 +0100)] 
detect: remove BUG_ON from packet path

6 years agodetect: fix match array reset
Victor Julien [Mon, 18 Mar 2019 09:34:03 +0000 (10:34 +0100)] 
detect: fix match array reset

Fix match array reset depending on prefilter matches for the
current run. If there were none, the match array of the previous
packet was used. This could lead to inspection of rules from the
wrong rule group.

6 years agoapp-layer/profile: fix udp protocol detection profiling
Victor Julien [Sat, 16 Mar 2019 17:04:16 +0000 (18:04 +0100)] 
app-layer/profile: fix udp protocol detection profiling

6 years agoapp-layer/udp: micro optimization
Victor Julien [Sat, 16 Mar 2019 14:01:37 +0000 (15:01 +0100)] 
app-layer/udp: micro optimization

6 years agoFix memory leak with TOS handling
Jeff Lucovsky [Sat, 9 Mar 2019 15:28:27 +0000 (07:28 -0800)] 
Fix memory leak with TOS handling

Use `pcre_copy_substring` to avoid memory allocations when parsing
TOS values.

6 years agopfring: update bpf error handling to be consistent
jason taylor [Thu, 14 Mar 2019 00:41:00 +0000 (20:41 -0400)] 
pfring: update bpf error handling to be consistent

* updated bpf error handling to be consistent with af-packet
* minor internal doc updates

Signed-off-by: jason taylor <jtfas90@gmail.com>
6 years agoreputation: move unit tests
Giuseppe Longo [Thu, 7 Mar 2019 15:38:47 +0000 (16:38 +0100)] 
reputation: move unit tests

UTs are moved inside "test/" directory,
and reworked to improve readability and reduce lines of code.

6 years agodetect-iprep: fix memory leaks
Giuseppe Longo [Sat, 9 Mar 2019 21:36:03 +0000 (22:36 +0100)] 
detect-iprep: fix memory leaks

Loading rules with iprep keyword cause
memory leaks due to missing frees.

Direct leak of 8 byte(s) in 4 object(s) allocated from:
    #0 0x7f81c862bd28 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc1d28)
    #1 0x7f81c6afea69 in pcre_get_substring (/lib/x86_64-linux-gnu/libpcre.so.3+0x27a69)
    #2 0x43206f7420676e68  (<unknown module>)

SUMMARY: AddressSanitizer: 8 byte(s) leaked in 4 allocation(s).

6 years agoflow-bypass: set thread name to FB
Eric Leblond [Wed, 6 Mar 2019 13:41:47 +0000 (14:41 +0100)] 
flow-bypass: set thread name to FB

6 years agosuricata.yaml: fix name of encryption-handling var
Eric Leblond [Thu, 12 Jul 2018 19:28:20 +0000 (21:28 +0200)] 
suricata.yaml: fix name of encryption-handling var

6 years agoautoconf/python: check for distutils 3714/head
Jason Ish [Sat, 9 Mar 2019 15:00:59 +0000 (09:00 -0600)] 
autoconf/python: check for distutils

Require distutils to install the Python tools. Update the logic
to only install suricatactl (and suricatasc) if Python and
distutils are found. Suricata-Update will only be installed if
bundled, and python-distutils and python-yaml are found.

6 years agoautoconf: prefer python 3 over python 2
Jason Ish [Mon, 11 Feb 2019 17:27:38 +0000 (11:27 -0600)] 
autoconf: prefer python 3 over python 2

When looking for Python, prefer "python3" over "python2" and
"python".

Also add information about the Python path and version to the
./configure summary.

Redmine issue:
https://redmine.openinfosecfoundation.org/issues/2808

6 years agoaf-packet: don't use anonymous unions 3706/head
Victor Julien [Sat, 2 Mar 2019 13:25:38 +0000 (14:25 +0100)] 
af-packet: don't use anonymous unions

6 years agoaf-packet: fix v3 code using v2 union member
Victor Julien [Sat, 2 Mar 2019 13:26:07 +0000 (14:26 +0100)] 
af-packet: fix v3 code using v2 union member

6 years agodoc/userguide: add 3rd-party-integration to dist
Victor Julien [Tue, 5 Mar 2019 11:43:40 +0000 (12:43 +0100)] 
doc/userguide: add 3rd-party-integration to dist

6 years agorust/ikev2: fix events not being raised in first message
Pierre Chifflier [Mon, 4 Mar 2019 17:47:07 +0000 (18:47 +0100)] 
rust/ikev2: fix events not being raised in first message

The `set_event` function requires that the transaction is already
inserted, or the event set is silently lost.
When parsing first IKEv2 message, first insert transaction, prepare
values, and borrow back inserted transaction to update it.

6 years agorules: fix event names for ikev2 (weak authentication and DH parameters)
Pierre Chifflier [Mon, 4 Mar 2019 17:45:38 +0000 (18:45 +0100)] 
rules: fix event names for ikev2 (weak authentication and DH parameters)

6 years agotravis: call make check in qa/coccinelle
Jason Ish [Mon, 25 Feb 2019 19:52:12 +0000 (13:52 -0600)] 
travis: call make check in qa/coccinelle

Was being skipped due to the way the tests are called on
travis to prevent Travis from failing on too much output.

6 years agotravis/macos: use xcode 8.3 build image
Jason Ish [Mon, 25 Feb 2019 19:44:19 +0000 (13:44 -0600)] 
travis/macos: use xcode 8.3 build image

Travis retired the xcode 8.1 image and has already been
routing this build to the xcode 8.3 image.

6 years agotravis-ci/macos: install PyYAML and jq for verify
Jason Ish [Mon, 25 Feb 2019 19:43:17 +0000 (13:43 -0600)] 
travis-ci/macos: install PyYAML and jq for verify

6 years agotravis: cache rust toolchain
Jason Ish [Mon, 25 Feb 2019 18:47:17 +0000 (12:47 -0600)] 
travis: cache rust toolchain

6 years agotravis-ci: run suricata-verify on each build
Jason Ish [Mon, 25 Feb 2019 18:24:41 +0000 (12:24 -0600)] 
travis-ci: run suricata-verify on each build

6 years agodoc/userguide: new 3rd party section, add bluecoat
Victor Julien [Mon, 25 Feb 2019 13:59:37 +0000 (14:59 +0100)] 
doc/userguide: new 3rd party section, add bluecoat

Add Symantec SSLV (bluecoat) doc to new 3rd party section for
documenting integrating Suricata with 3rd party tools.

6 years agodoc: add byte_* documentation to the userguide 3703/head
Bryant Smith [Sat, 2 Mar 2019 17:07:25 +0000 (10:07 -0700)] 
doc: add byte_* documentation to the userguide

Added byte_test, byte_jump and byte_extract description and example rules

6 years agostream/ips: set proper payload len for inspection
Victor Julien [Wed, 27 Feb 2019 06:16:18 +0000 (07:16 +0100)] 
stream/ips: set proper payload len for inspection

On mem(cap) presure we fall back to the packet payload. The previous
patch failed to properly set the payload length.

6 years agofile-log: remove and add warning 3680/head
Victor Julien [Sun, 24 Feb 2019 18:56:29 +0000 (19:56 +0100)] 
file-log: remove and add warning

Feature was deprecated and scheduled for removal.

Ticket #2376

6 years agodoc: improvement of xbits documentation page
Eric Leblond [Sun, 24 Feb 2019 08:30:38 +0000 (09:30 +0100)] 
doc: improvement of xbits documentation page

6 years agodoc: xbits:noalert is not a valid syntax
Eric Leblond [Tue, 19 Feb 2019 08:53:02 +0000 (09:53 +0100)] 
doc: xbits:noalert is not a valid syntax

6 years agodetect-hostbits: error on some invalid config
Eric Leblond [Mon, 18 Feb 2019 22:06:10 +0000 (23:06 +0100)] 
detect-hostbits: error on some invalid config

6 years agodetect-xbits: error on some invalid config
Eric Leblond [Mon, 18 Feb 2019 21:59:01 +0000 (22:59 +0100)] 
detect-xbits: error on some invalid config

6 years agodetect-flowbits: error on some invalid syntax
Eric Leblond [Mon, 18 Feb 2019 21:31:26 +0000 (22:31 +0100)] 
detect-flowbits: error on some invalid syntax

The regular expression was accepting something like
"flowbits:!isset,isma;" without complaining even if it is not
correct and don't have the expected result.

6 years agosuricata: fix list keywords URL in release mode
Eric Leblond [Mon, 18 Feb 2019 13:27:18 +0000 (14:27 +0100)] 
suricata: fix list keywords URL in release mode

The tags are suricata-X.X.X so we need to update the chain to get
URLs right.

6 years agounix-socket: Fix the message for unregister-tenant-handler
Shivani Bhardwaj [Wed, 20 Feb 2019 10:26:34 +0000 (15:56 +0530)] 
unix-socket: Fix the message for unregister-tenant-handler

6 years agodoc/unix-socket: Add missing commands and detail
Shivani Bhardwaj [Wed, 20 Feb 2019 10:17:01 +0000 (15:47 +0530)] 
doc/unix-socket: Add missing commands and detail

Add missing commands and their corresponding details in unix-socket
userguide.

Closes redmine ticket #2800

6 years agosuricatactl: Clean up parser, improve help
Shivani Bhardwaj [Wed, 20 Feb 2019 18:10:14 +0000 (23:40 +0530)] 
suricatactl: Clean up parser, improve help

So far the suricatactl parser was unclear about the options to use and
did not well display the required and optional param difference. Fix
that to make it legible for any user.

Before
```
└─ $ â–¶ ./bin/suricatactl filestore -h
usage: suricatactl filestore [-h] {prune} ...

positional arguments:
  {prune}

optional arguments:
  -h, --help  show this help message and exit

└─ $ â–¶ ./bin/suricatactl filestore prune -h
usage: suricatactl filestore prune [-h] [-d DIRECTORY] [--age AGE] [-n] [-v]
                                   [-q]

optional arguments:
  -h, --help            show this help message and exit
  -d DIRECTORY, --directory DIRECTORY
                        filestore directory
  --age AGE             prune files older than age
  -n, --dry-run         only print what would happen
  -v, --verbose         increase verbosity
  -q, --quiet           be quiet, log warnings and errors only
```

After
```
└─ $ â–¶ ./bin/suricatactl filestore -h
usage: suricatactl filestore [-h] {prune} ...

positional arguments:
  {prune}     sub-command help
    prune     Remove files in specified directory older than specified age

optional arguments:
  -h, --help  show this help message and exit

└─ $ â–¶ ./bin/suricatactl filestore prune -h
usage: suricatactl filestore prune [-h] -d DIRECTORY [--age AGE] [-n] [-v]
                                   [-q]

optional arguments:
  -h, --help            show this help message and exit
  -n, --dry-run         only print what would happen
  -v, --verbose         increase verbosity
  -q, --quiet           be quiet, log warnings and errors only

required arguments:
  -d DIRECTORY, --directory DIRECTORY
                        filestore directory
  --age AGE             prune files older than age, units: s, m, h, d
```

6 years agosuricatactl: Fix PyLint issues
Shivani Bhardwaj [Sat, 16 Feb 2019 18:49:22 +0000 (00:19 +0530)] 
suricatactl: Fix PyLint issues

Pylint is a tool to make sure we do not regress the support for Python
3. The following conventions, warnings, errors, refactors have been
fixed.

W0301: Unnecessary semicolon (unnecessary-semicolon)
C0303: Trailing whitespace (trailing-whitespace)
W1401: Anomalous backslash in string
C0103: Variable name doesn't conform to snake_case naming style
R1705: Unnecessary "elif" after "return"
W1201: Specify string format arguments as logging function parameters
W0611: Unused import
R1710: Either all return statements in a function should return an expression, or none of them should
W0612: Unused variable
C0103: Method name doesn't conform to snake_case naming style
R0201: Method could be a function

6 years agosuricatactl: Make code compatible with Python 3
Shivani Bhardwaj [Sat, 16 Feb 2019 17:57:24 +0000 (23:27 +0530)] 
suricatactl: Make code compatible with Python 3

Call to suricatactl was failing with Python3 with the following error:
```
Traceback (most recent call last):
  File "bin/suricatactl", line 40, in <module>
    sys.exit(main())
  File "./suricata/ctl/main.py", line 50, in main
    args.func(args)
AttributeError: 'Namespace' object has no attribute 'func'
```
Fix this by making it run with Py3 just like it does with Py2.

Closes redmine ticket #2793

6 years agodoc: add table for custom values of eve/http
Victor Julien [Sat, 23 Feb 2019 19:14:08 +0000 (20:14 +0100)] 
doc: add table for custom values of eve/http

6 years agoeve/http: add proxy related custom headers
Victor Julien [Sat, 23 Feb 2019 18:27:22 +0000 (19:27 +0100)] 
eve/http: add proxy related custom headers

6 years agoeve/http: fix custom header table
Victor Julien [Sat, 23 Feb 2019 18:03:13 +0000 (19:03 +0100)] 
eve/http: fix custom header table

6 years agosmtp: minor code cleanup and debug addition
Victor Julien [Sat, 23 Feb 2019 11:30:12 +0000 (12:30 +0100)] 
smtp: minor code cleanup and debug addition

6 years agochecksum: use u64 types
Victor Julien [Fri, 22 Feb 2019 21:01:37 +0000 (22:01 +0100)] 
checksum: use u64 types

6 years agoips/stream: handle low mem(cap) crash
Victor Julien [Fri, 22 Feb 2019 19:41:41 +0000 (20:41 +0100)] 
ips/stream: handle low mem(cap) crash

In low memory or memcap reached conditions a crash could happen in
inline stream detection.

The crash had the following path:

A packet would come in and it's data was added to the stream. Due
to earlier packet loss, the stream buffer uses a stream buffer block
tree to track the data blocks. When trying to add the current packets
block to the tree, the memory limit was reached and the add fails.

A bit later in the pipeline for the same packet, the inline stream
mpm inspection function gets the data to inspect. For inline mode
this is the current packet + stream data before and after the packet,
if available.

The code looking up the packets data in the stream would not
consider the possibility that the stream block returned wasn't
the right one. The tree search returns either the correct or the
next block. In adjusting the returned block to add the extra stream
data it would miscalculate offsets leading to a corrupt pointer to the
data.

This patch more carefully checks the result of the lookup, and
falls back to simply inspecting the packet payload if the lookup
didn't produce the expected result.

Bug 2842.

Reported-by: Ad Schellevis <ad@opnsense.org>
6 years agostream-buffer: fix block search compare func
Victor Julien [Fri, 22 Feb 2019 15:14:48 +0000 (16:14 +0100)] 
stream-buffer: fix block search compare func

Sbb search function could return the wrong block due to an off by
one error.

6 years agostream-buffer: fix streaming buffer size issue
Victor Julien [Fri, 22 Feb 2019 10:55:07 +0000 (11:55 +0100)] 
stream-buffer: fix streaming buffer size issue

It was using buffer size instead of the real usage of the buffer.

6 years agoflow-manager: improve thread shutdown loops
Victor Julien [Thu, 21 Feb 2019 19:33:01 +0000 (20:33 +0100)] 
flow-manager: improve thread shutdown loops

6 years agothreads: move sleep macros into common header
Victor Julien [Thu, 21 Feb 2019 19:32:40 +0000 (20:32 +0100)] 
threads: move sleep macros into common header

6 years agogithub: update codeowners
Victor Julien [Fri, 22 Feb 2019 09:19:39 +0000 (10:19 +0100)] 
github: update codeowners

6 years agompm/ac-ks: rename files from -tile to -ks
Victor Julien [Thu, 21 Feb 2019 09:21:42 +0000 (10:21 +0100)] 
mpm/ac-ks: rename files from -tile to -ks

6 years agotile: remove files
Victor Julien [Wed, 20 Feb 2019 20:28:18 +0000 (21:28 +0100)] 
tile: remove files

6 years agompm: rename internal id for ac-tile to ac-ks
Victor Julien [Wed, 20 Feb 2019 20:11:14 +0000 (21:11 +0100)] 
mpm: rename internal id for ac-tile to ac-ks

6 years agodetect/pcre: fix false positive 3673/head
Victor Julien [Wed, 20 Feb 2019 15:58:34 +0000 (16:58 +0100)] 
detect/pcre: fix false positive

Fix case where a HTTP modifier in PCRE statements would lead to
the rule alerting when it should not.

Bug #2769

6 years agodecoder: improve stats hash error handling
Victor Julien [Mon, 18 Feb 2019 14:17:36 +0000 (15:17 +0100)] 
decoder: improve stats hash error handling

6 years agonetmap: switch to nm_* API
Victor Julien [Wed, 29 Jun 2016 15:55:54 +0000 (17:55 +0200)] 
netmap: switch to nm_* API

Process multiple packets at nm_dispatch. Use zero copy for workers
recv mode.

Add configure check netmap check for API 11+ and find netmap api version.

Add netmap guide to the userguide.

6 years agofilestore v2: print sid in json output
magenbluten [Fri, 15 Feb 2019 14:31:41 +0000 (14:31 +0000)] 
filestore v2: print sid in json output

6 years agoengine-analysis: add support for http_host buffer
Travis Green [Fri, 15 Feb 2019 22:03:30 +0000 (15:03 -0700)] 
engine-analysis: add support for http_host buffer

Add support for http_host buffer for more accurate reporting.
Bug: #2798

6 years agoconfigure: rust support requires Python
Eric Leblond [Tue, 12 Feb 2019 11:55:08 +0000 (12:55 +0100)] 
configure: rust support requires Python

Add error message to warn the user.

6 years agonfqueue: more descriptive queue names (e.g. 'NFQ#1' instead of '1')
Alexander Gozman [Sat, 9 Feb 2019 09:49:52 +0000 (12:49 +0300)] 
nfqueue: more descriptive queue names (e.g. 'NFQ#1' instead of '1')

This will also make 'iface-list' output more informative.

6 years agonfqueue: added received packets counter for 'iface-stat' command
Alexander Gozman [Sun, 3 Feb 2019 17:19:13 +0000 (20:19 +0300)] 
nfqueue: added received packets counter for 'iface-stat' command

Previously nfqueue did not update received packets counter in a
livedev so 'iface-stat' UNIX-socket command always showed zeros.

6 years agoeve/fileinfo: don't alloc filename during logging
Victor Julien [Wed, 12 Dec 2018 19:15:56 +0000 (20:15 +0100)] 
eve/fileinfo: don't alloc filename during logging

6 years agoeve/ftp: don't alloc memory to log filename
Victor Julien [Wed, 12 Dec 2018 18:57:14 +0000 (19:57 +0100)] 
eve/ftp: don't alloc memory to log filename

6 years agoeve/http: use stack for buffer to string conversions
Victor Julien [Wed, 12 Dec 2018 14:06:18 +0000 (15:06 +0100)] 
eve/http: use stack for buffer to string conversions

6 years agobyte: add bytes to string w/o allocation
Victor Julien [Wed, 12 Dec 2018 13:35:11 +0000 (14:35 +0100)] 
byte: add bytes to string w/o allocation

6 years agoapp-layer-ssl: check that cipher suites length is divisible by two
Mats Klepsland [Sat, 16 Feb 2019 20:55:19 +0000 (21:55 +0100)] 
app-layer-ssl: check that cipher suites length is divisible by two

Cipher suites length should always be divisible by two. If it is a
odd number, which should not happen with normal traffic, it ends up
reading one byte too much.

6 years agoutil-ja3: fix AddressSanitizer heap-buffer-overflow
Mats Klepsland [Sat, 16 Feb 2019 20:49:23 +0000 (21:49 +0100)] 
util-ja3: fix AddressSanitizer heap-buffer-overflow

No resizing is done in Ja3BufferResizeIfFull() when the buffer is
empty. This leads to a potential overflow when this happens, since
a ',' is appended even when the buffer is empty.

Bug #2762

6 years agowindows: msys/mingw based appveyor support 3669/head
Victor Julien [Tue, 19 Feb 2019 08:44:14 +0000 (09:44 +0100)] 
windows: msys/mingw based appveyor support

Add rust but have it disabled as it is broken.

Add windivert, winpcap and npcap builds.

Run unittests on one of the builds.

Use reasonably strict CFLAGS.

6 years agowindows/syscall: fix unused function warning
Victor Julien [Wed, 20 Feb 2019 09:46:03 +0000 (10:46 +0100)] 
windows/syscall: fix unused function warning

6 years agowindows/syscall: convert file to use unix newlines
Victor Julien [Wed, 20 Feb 2019 09:44:30 +0000 (10:44 +0100)] 
windows/syscall: convert file to use unix newlines

ran: dos2unix src/win32-syscall.[ch]

6 years agoconfigure: support msys target
Victor Julien [Tue, 19 Feb 2019 10:10:31 +0000 (11:10 +0100)] 
configure: support msys target

6 years agowindows: fix sc_log_stream_lock handling
Victor Julien [Tue, 19 Feb 2019 15:44:32 +0000 (16:44 +0100)] 
windows: fix sc_log_stream_lock handling

6 years agowindows: allow multiple pcap devices on commandline 3661/head
Victor Julien [Fri, 15 Feb 2019 10:29:00 +0000 (11:29 +0100)] 
windows: allow multiple pcap devices on commandline

Ticket #2774

6 years agoips: set host mode only after engine mode
Victor Julien [Fri, 15 Feb 2019 09:45:12 +0000 (10:45 +0100)] 
ips: set host mode only after engine mode

Make sure it is set after the final engine mode update.

6 years agostream: fix 'stream.inline=auto' for L2 IPS
Victor Julien [Fri, 15 Feb 2019 09:37:42 +0000 (10:37 +0100)] 
stream: fix 'stream.inline=auto' for L2 IPS

Make sure the livedev setup is finalized before initializing the
stream engine.

Bug #2811

Reported-by: Ad Schellevis
6 years agoflow: log gap state per direction
Victor Julien [Tue, 12 Feb 2019 14:30:15 +0000 (15:30 +0100)] 
flow: log gap state per direction

6 years agostream: no more stream events after known issue
Victor Julien [Fri, 2 Nov 2018 16:27:59 +0000 (17:27 +0100)] 
stream: no more stream events after known issue

No longer set stream events after a gap or wrong thread. We know
we lost sync and are now in 'lets make the best of it'-mode. No
point in flooding the system with stream events.

Ticket #2484

6 years agosuricatasc: Fix command failures
Shivani Bhardwaj [Wed, 13 Feb 2019 11:02:06 +0000 (16:32 +0530)] 
suricatasc: Fix command failures

This commit addresses the following three cases:

1. Do not use maxsplit keyword arg
maxsplit argument to the split command was not a part of Python 2
and using it with Python 2 causes the following failure:
```
TypeError: split() takes no keyword arguments
```
Avoid this by eliminating all the named arguments from split.

2. Fix failure on extra arguments
Up until now, suricatasc fails if any command which is not supposed to
take args is given args.
Fix this by ignoring any extra params.
Closes redmine ticket #2813

3. Fix failure on different type of args
If a command was given a string argument where it expected an int, it
would fail and the process would exit.
Fix this by handling the exception caused in such cases.
Closes redmine ticket #2812

6 years agosuricatasc: Use better exception message, sort imports
Shivani Bhardwaj [Fri, 8 Feb 2019 10:02:24 +0000 (15:32 +0530)] 
suricatasc: Use better exception message, sort imports

Up until now, suricatasc gives a message as follows in case a command is
missing arguments:
```
>>> list-hostbit
Arguments to command 'list-hostbit' is missing
```

Fix this up and provide a better message:
```
>>> list-hostbit
Missing arguments: expected 1
>>> pcap-file-continuous
Missing arguments: expected at least 2
```

6 years agosuricatasc: Snug the processing of different commands
Shivani Bhardwaj [Thu, 7 Feb 2019 12:09:15 +0000 (17:39 +0530)] 
suricatasc: Snug the processing of different commands

Since all of the commands were following the same procedure, namely,
split the input extract the arguments, throw the error if required
argument is missing else send the command over to suricata, put all of
this in one compact function alongwith a dictionary for specifications
for different commands, the name of the argument, the type and if it is
required or not.
Following fixups come with this commit:
- Code becomes really cozy
- Split errors on a few commands are well handled
- No redundant code
- More readability

References redmine ticket #2793

6 years agosuricatasc: Get rid of issues detected by Pylint
Shivani Bhardwaj [Thu, 7 Feb 2019 10:00:44 +0000 (15:30 +0530)] 
suricatasc: Get rid of issues detected by Pylint

Pylint is a tool to make sure we do not regress the support for Python
3. The following conventions, warnings, errors, refactors have been
fixed.

C0326: Exactly one space required around assignment
C0326: No space allowed around keyword argument assignment
C0325: Unnecessary parens after 'if' keyword
W0301: Unnecessary semicolon
W0702: No exception type(s) specified
W0231: __init__ method from base class 'Exception' is not called
W0107: Unnecessary pass statement
C0121: Comparison to None should be 'expr is not None'
E0602: Undefined variable 'raw_input'
W0201: Attribute 'socket' defined outside __init__
W0611: Unused import

6 years agodcerpc/udp: fix int mishandling in opnum parsing 3652/head
Victor Julien [Fri, 25 Jan 2019 11:00:13 +0000 (12:00 +0100)] 
dcerpc/udp: fix int mishandling in opnum parsing

For Big Endian support in the protocol, the opnum would not be set
correctly.

Found using undefined sanitizer.

6 years agofile/swf: fix undefined int behaviour
Victor Julien [Fri, 25 Jan 2019 10:52:06 +0000 (11:52 +0100)] 
file/swf: fix undefined int behaviour

Fix warnings by the undefined sanitizer.