Commit Graph

64 Commits (2dc6b6ee14b0886783674fecaaa50e62328f9727)

Author SHA1 Message Date
Jason Ish a7d90162d1 suricatasc: move into python/
Will be built and installed as part of the Python code used
for suricatactl, which is intended to be the generic place
for all Python utility code that gets installed with Suricata.

No change to suricatasc code.
7 years ago
Danny Browning 4b897c9060 source-pcap-file: Directory mode may miss files (bug #2394)
https://redmine.openinfosecfoundation.org/issues/2394

Certain parameters of delay and poll interval could cause newly added
files in a directory to be missed. Cleaned up how time is handled for
files in a directory and fix which time is used for future directory
traversals. Add a mutex to make sure processing time is not optimized
away.
7 years ago
Jason Ish f70e8d00ea dnp3-gen: require jinja2 v2.10 or later
Previous versions, but not all, have issues tracking
variables.
7 years ago
Philippe Antoine 6a6aa04f55 dnp3-gen: fix heap buffer overflow in generated code
Due to missing check before memcpy.
7 years ago
Eric Leblond 3c68a22092 suricatasc: implement autoreconnect
Implement a basic autoreconnect support. It tries to reconnect once
when connection has been lost. If it fails, it discards the command
and try again to connect at next command.
7 years ago
Eric Leblond 3d0ba36ba8 unix socket: protocol v0.2
This patch updates the unix socket protocol. Messages send from
the server and the client have now a '\n' at the end. This allows
both sides to detect easily the end of a command.

As a side effect, this fixes the problem of long answer in
suricatasc. There is now a limit at the arbitrary value of 65536.

Backward compatility is preserved as a client with the older
version of the protocol can still connect to a Suricata with
version 2 of the protocol.
7 years ago
Jason Ish 3fd7256af5 setup-app-layer-detect: update for changes in detect 7 years ago
Danny Browning 0813f08075 suricatasc: pcap-file-continuous (2412)
https://redmine.openinfosecfoundation.org/issues/2412

Suricatasc is not supporting pcap-file processing in continuous mode.
Register a new command pcap-file-continuous in the unix manager to work
with suricatasc. Add defaulted arguments for pcap-file to support
backwards compatibility.
7 years ago
Jason Ish 46d754044e suricatasc: don't use find -delete
For when -delete isn't supported by find. Instead use
-print0 with xargs -0.
7 years ago
Giuseppe Longo 16ddba61d6 suricatasc: add commands for memcap handling 7 years ago
Jason Ish 84f09d5124 template scripts: fixup detect setup scripts
Update scripts to reflect recent changes in the detection files.
7 years ago
Dana Helwig 3ab9120821 source-pcap-file: Pcap Directory Mode (Feature #2222)
https://redmine.openinfosecfoundation.org/issues/2222

Pcap file mode that when passed a directory will process all files in
that directory. If --pcap-file-continuous or continuous option is passed
in json, the directory will be monitored  until the directory is
moved/deleted, suricata is interrupted, or the pcap-interrupt command
is used with unix command socket. Existing file implementation and new
directory implementation has moved from source-pcap-file into
pcap-file-helper and pcap-directory-helper.

Engine state will not reset between files.

Also satisfies:
 * https://redmine.openinfosecfoundation.org/issues/2299
 * https://redmine.openinfosecfoundation.org/issues/724
 * https://redmine.openinfosecfoundation.org/issues/1476

Co-Authors: Dana Helwig <dana.helwig@protectwise.com> and
Danny Browning <danny.browning@protectwise.com>
7 years ago
Pierre Chifflier 862abd2fe4 applayer: add StringToAppProto
Add StringToAppProto to map a protocol name to a AppProto.

Exposing this function is required to let parsers discover their
AppProto identifier constant dynamically.
For example, a parser can request this value, and use it for
registration without knowing the value.
7 years ago
Jason Ish 40a1a972d6 template: script to check the setup scripts
This script applies the setup scripts one by one followed
by a make distcheck.
7 years ago
Jason Ish d1ac839333 template scripts: allow to be called from top or src
Allow the template setup script to be called from the top source
directory or from ./src to unify where they can be executed
from.
7 years ago
Jason Ish ea2ef1b51a templates: rename scripts to use - instead of _
Use "-" consistently instead of a mix of - and _.

setup_decoder.sh -> setup-decoder.sh
setup_simple_detect.sh -> setup-simple-detect.sh
7 years ago
Victor Julien 499afaba4b template: fix decoder setup script 7 years ago
Victor Julien 7783847467 template: fix setup detect script 7 years ago
Jason Ish 6bddc4d3e0 python: use python path found during configure
Also look for Python under more names. For example, on OpenBSD
if you just install Python 2, you will only get a python2.7
executable.
7 years ago
Jason Ish ac7cf48a98 dnp3: in template, include files own headers
To deal with -Wmissing-prototypes as added in
ab1200fbd7

Note: Change was already applied to source files, this just
updates the generation.
8 years ago
Jason Ish e69ce30d87 template script: typo in app-layer setup script
Check for ed was failing, as it was actually looking for edx.
8 years ago
Victor Julien 8fde6f967f suricatasc: add/list/remove hostbit commands
Syntax:
    add-hostbit <ip> <bit name> <expire>
Example:
    add-hostbit 1.2.3.4 blacklist 3600

Syntax:
    remove-hostbit <ip> <bit name>
Example:
    remove-hostbit 1.2.3.4 blacklist

Syntax:
    list-hostbit <ip>
Example:
    list-hostbit 1.2.3.4
8 years ago
Victor Julien 322c260749 afl: minimalistic script to start AFL fuzzers
in suricata source dir:

mkdir afl
cd afl
bash ../scripts/afl/runafl.sh decoder-ipv4
8 years ago
Victor Julien 6bd265258e afl: util script to list crashed series 8 years ago
Jason Ish f73806211a template script: use bash and require ed
For now these scripts only work in bash, and the "ed" program
is required.
8 years ago
Jason Ish 1abaf1c96d templates: require the protocol name to start with a capital
When running ./setup-app-layer.sh require the protocol name to
start with a capital letter so it looks somewhat like a proper
name. This will help give better function names.

For example:

   ./setup-app-layer.sh IRC
   ./setup-app-layer.sh Irc

will create function names starting with IRC or Irc. But we do
not want function names to start with "irc".
8 years ago
Jason Ish 2a0bb108d0 dnp3-gen: rename index variable to point_index
Gcc 4.6 will warning with -Wshadow for a local variable
named "index" as <strings.h> has a function named "index".

Newer versions of gcc handle this case.
8 years ago
Jason Ish 240d789c40 DNP3: dnp3-gen: code generator for repetitive DNP3 code 8 years ago
Jason Ish bbbc5ab1fc setup-app-layer-logger.sh: update for logging changes 8 years ago
Jason Ish dc2c896781 app-layer setup scripts: enable new modules on copy
The templates are disabled by default, enable the copy
of the template so the new app-layer modules are enabled by
by default.
9 years ago
Jason Ish 84fd28eaed app-layer setup scripts: fix header substitution.
Fixes make distcheck.
9 years ago
Jason Ish 4a738023d5 app-layer: scripts to setup app-layer templates
setup-app-layer.sh sets up an application layer detector and
parser template.

setup-app-layer-logger.sh sets up a JSON application layer
transaction logger for an application parser that has
already been provisioned.

setup-app-layer-detect.sh sets up a keyword for performing
content inspections on buffers created by the application
layer.
9 years ago
Victor Julien a4bce14770 development tools: add script to setup detect module
Simplify creation of a new detect module by creating a copy of the
detect template. It sets the name and registers it in the build
system. Finally it's registration function is called.
9 years ago
Victor Julien 85b00dcfa0 development tools: add script to setup new decoder
Simplify creation of a new decoder.
9 years ago
Victor Julien 4d0975eeac multi-detect: implement reload tenant in suricatasc 9 years ago
Victor Julien a20e43f97c suricatasc: add unregister-tenant-handler 9 years ago
Victor Julien a21e88d955 suricatasc: add register-tenant-handler command
Arguments:
- tenant id (int)
- name of handler (string)
- traffic id related to handler (int, optional)

Examples:
- register-tenant-handler 1 vlan 1111
- register-tenant-handler 8 pcap
9 years ago
Victor Julien 127d8183d7 suricatasc: allow for tenant id in pcap-file
Allow for an optional 'tenant id' argument to pcap-file. This will
allow us to force the pcap to be inspected by this tenant.

If ommited it's 0, which means it's disabled.
9 years ago
Victor Julien 147a6d2bfd multi-detect: (un)register-tenant unix socket commands
Make available to live mode and unix socket mode.

register-tenant:
    Loads a new YAML, does basic validation.
    Loads a new detection engine
    Loads rules
    Add new de_ctx to master store and stores tenant id in the de_ctx so
        we can look it up by tenant id later.

unregister-tenant:
    Gets the de_ctx, moves it to the freelist
    Removes config

Introduce DetectEngineGetByTenantId, which gets a reference to the
detect engine by tenant id.
9 years ago
Alexander Gozman e028917955 In non interactive mode, print errors to stderr 9 years ago
Alexander Gozman a9176cf126 suricatasc: remove "u" prefix when printing JSON output.
If we want to parse suricatasc's output, python's unicode prefix
should be removed to make JSON parsers happy.
9 years ago
Victor Julien 3fbc6ede6b suricatasc: allow for longer response times after connect 10 years ago
Victor Julien 664100c074 suricatasc: allow for much longer response times 10 years ago
Eric Leblond e564ac77fd suricatasc: exit with error if command returns NOK 10 years ago
Eric Leblond 55ccd3b17d suricatasc: now python 2 and 3 compatible
Update code to support both python 2 and python 3.
10 years ago
Victor Julien 84e8217fd8 unix-socket: allow socked in custom locations
Allow the socket to be set in any location. This allows for easy
setting up of a socket as a non-root user.
10 years ago
Eric Leblond 7f68a25535 suricatasc: add -c flag to run command
Add -c flag to run command given as argument and return the raw
JSON result. For example, it is possible to run something like.
 $ suricatasc  -c "iface-stat eth0"
 {'message': {'pkts': 17838352, 'drop': 0, 'invalid-checksums': 1}, 'return': 'OK'}
10 years ago
Eric Leblond 1b9cc03653 suricatasc: factorize command parsing 10 years ago
Noam Meltzer e873443adb fix regression in 'make distclean' due to commit cd305c3a
the files under scripts/suricatasc/src are actual sources and should not
be cleaned
11 years ago
Eric Leblond ff2b8009ef suricatasc: fix make distcheck. 12 years ago