version:7.0.6
system: ubuntu22.04
The problem still exists.
root@lxx:~/7.6/suricata-7.0.6# python3 scripts/setup-app-layer.py S7comm
Creating directory rust/src/applayers7comm.
Generating rust/src/applayers7comm/mod.rs.
Formatting rust/src/applayers7comm/mod.rs
Error writing files: failed to resolve mod `parser`: /root/7.6/suricata-7.0.6/rust/src/applayers7comm/parser.rs does not exist
Generating rust/src/applayers7comm/s7comm.rs.
Formatting rust/src/applayers7comm/s7comm.rs
Generating rust/src/applayers7comm/parser.rs.
Formatting rust/src/applayers7comm/parser.rs
Patching rust/src/lib.rs.
Patching src/app-layer-protos.h.
Patching src/app-layer-protos.c.
Patching src/app-layer-parser.c.
Patching suricata.yaml.in.
Generating src/output-json-s7comm.h.
Generating src/output-json-s7comm.c.
Generating rust/src/applayers7comm/logger.rs.
Formatting rust/src/applayers7comm/logger.rs
Patching rust/src/applayers7comm/mod.rs.
Formatting rust/src/applayers7comm/mod.rs
Patching src/Makefile.am.
Patching src/output.c.
Patching suricata.yaml.in.
An application detector and parser for the protocol S7comm have
now been setup in the files:
rust/src/applayers7comm/mod.rs
rust/src/applayers7comm/parser.rs
A JSON application layer transaction logger for the protocol
S7comm has now been set in the file:
rust/src/applayers7comm/logger.rs
Suricata should now build cleanly. Try running "./configure" and "make".
root@lxx:~/7.6/suricata-7.0.6# python3 scripts/setup-app-layer.py --detect S7comm S7commbuf
Generating src/detect-s7comm-s7commbuf.h.
Generating src/detect-s7comm-s7commbuf.c.
Patching src/Makefile.am.
Patching src/detect-engine-register.c.
Patching src/detect-engine-register.h.
The following files have been created and linked into the build:
detect-s7comm-s7commbuf.h
detect-s7comm-s7commbuf.c
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
#s7comm.rs modify port 102
#modify suricata.yaml
make
make install
The problem still exists.
I am unable to get any output in s7comm.rs
, but the pcap file is being read.
Even a simple ‘Hello World’ cannot be output.
root@lxx:~/7.6/suricata-7.0.6# suricata -c /etc/suricata/suricata.yaml -r dump.pcapng -vvv
[65198] Notice: suricata: This is Suricata version 7.0.5 RELEASE running in USER mode
[65198] Info: cpu: CPUs/cores online: 4
[65198] Info: suricata: Setting engine mode to IDS mode by default
[65198] Info: exception-policy: master exception-policy set to: auto
[65198] Config: exception-policy: app-layer.error-policy: ignore
[65198] Config: app-layer-htp: 'default' server has 'request-body-minimal-inspect-size' set to 31186 and 'request-body-inspect-window' set to 4158 after randomization.
[65198] Config: app-layer-htp: 'default' server has 'response-body-minimal-inspect-size' set to 40047 and 'response-body-inspect-window' set to 16192 after randomization.
[65198] Config: smb: read: max record size: 16777216, max queued chunks 64, max queued size 67108864
[65198] Config: smb: write: max record size: 16777216, max queued chunks 64, max queued size 67108864
[65198] Config: app-layer-enip: Protocol detection and parser disabled for enip protocol.
[65198] Config: app-layer-dnp3: Protocol detection and parser disabled for DNP3.
[65198] Notice: s7comm: Rust s7comm parser registered.
[65198] Notice: output-json-s7comm: S7comm JSON logger registered.
[65198] Config: host: allocated 262144 bytes of memory for the host hash... 4096 buckets of size 64
[65198] Config: host: preallocated 1000 hosts of size 136
[65198] Config: host: host memory usage: 398144 bytes, maximum: 33554432
[65198] Config: coredump-config: Core dump size set to unlimited.
[65198] Config: exception-policy: defrag.memcap-policy: ignore (defined via 'exception-policy' master switch)
[65198] Config: defrag-hash: allocated 3670016 bytes of memory for the defrag hash... 65536 buckets of size 56
[65198] Config: defrag-hash: preallocated 65535 defrag trackers of size 160
[65198] Config: defrag-hash: defrag memory usage: 14155616 bytes, maximum: 33554432
[65198] Config: exception-policy: flow.memcap-policy: ignore (defined via 'exception-policy' master switch)
[65198] Config: flow: flow size 296, memcap allows for 453438 flows. Per hash row in perfect conditions 6
[65198] Config: stream-tcp: stream "prealloc-sessions": 2048 (per thread)
[65198] Config: stream-tcp: stream "memcap": 67108864
[65198] Config: stream-tcp: stream "midstream" session pickups: disabled
[65198] Config: stream-tcp: stream "async-oneside": disabled
[65198] Config: stream-tcp: stream "checksum-validation": enabled
[65198] Config: exception-policy: stream.memcap-policy: ignore (defined via 'exception-policy' master switch)
[65198] Config: exception-policy: stream.reassembly.memcap-policy: ignore (defined via 'exception-policy' master switch)
[65198] Config: exception-policy: stream.midstream-policy: ignore (defined via 'exception-policy' master switch)
[65198] Config: stream-tcp: stream."inline": disabled
[65198] Config: stream-tcp: stream "bypass": disabled
[65198] Config: stream-tcp: stream "max-syn-queued": 10
[65198] Config: stream-tcp: stream "max-synack-queued": 5
[65198] Config: stream-tcp: stream.reassembly "memcap": 268435456
[65198] Config: stream-tcp: stream.reassembly "depth": 1048576
[65198] Config: stream-tcp: stream.reassembly "toserver-chunk-size": 2639
[65198] Config: stream-tcp: stream.reassembly "toclient-chunk-size": 2582
[65198] Config: stream-tcp: stream.reassembly.raw: enabled
[65198] Config: stream-tcp: stream.liberal-timestamps: disabled
[65198] Config: stream-tcp-reassemble: stream.reassembly "segment-prealloc": 2048
[65198] Config: stream-tcp-reassemble: stream.reassembly "max-regions": 8
[65198] Info: logopenfile: fast output device (regular) initialized: fast.log
[65198] Info: logopenfile: eve-log output device (regular) initialized: eve.json
[65198] Config: runmodes: enabling 'eve-log' module 's7comm'
[65198] Notice: output-json-s7comm: S7comm log sub-module initialized.
[65198] Config: runmodes: enabling 'eve-log' module 'alert'
[65198] Config: runmodes: enabling 'eve-log' module 'frame'
[65198] Config: runmodes: enabling 'eve-log' module 'anomaly'
[65198] Config: runmodes: enabling 'eve-log' module 'http'
[65198] Config: runmodes: enabling 'eve-log' module 'dns'
[65198] Config: runmodes: enabling 'eve-log' module 'tls'
[65198] Config: runmodes: enabling 'eve-log' module 'files'
[65198] Config: runmodes: enabling 'eve-log' module 'smtp'
[65198] Config: runmodes: enabling 'eve-log' module 'ftp'
[65198] Config: runmodes: enabling 'eve-log' module 'rdp'
[65198] Config: runmodes: enabling 'eve-log' module 'nfs'
[65198] Config: runmodes: enabling 'eve-log' module 'smb'
[65198] Config: runmodes: enabling 'eve-log' module 'tftp'
[65198] Config: runmodes: enabling 'eve-log' module 'ike'
[65198] Config: runmodes: enabling 'eve-log' module 'dcerpc'
[65198] Config: runmodes: enabling 'eve-log' module 'krb5'
[65198] Config: runmodes: enabling 'eve-log' module 'bittorrent-dht'
[65198] Config: runmodes: enabling 'eve-log' module 'snmp'
[65198] Config: runmodes: enabling 'eve-log' module 's7comm'
[65198] Notice: output-json-s7comm: S7comm log sub-module initialized.
[65198] Config: runmodes: enabling 'eve-log' module 'rfb'
[65198] Config: runmodes: enabling 'eve-log' module 'sip'
[65198] Config: runmodes: enabling 'eve-log' module 'quic'
[65198] Config: runmodes: enabling 'eve-log' module 'dhcp'
[65198] Config: runmodes: enabling 'eve-log' module 'ssh'
[65198] Config: runmodes: enabling 'eve-log' module 'mqtt'
[65198] Config: runmodes: enabling 'eve-log' module 'http2'
[65198] Config: runmodes: enabling 'eve-log' module 'pgsql'
[65198] Config: runmodes: enabling 'eve-log' module 'stats'
[65198] Config: runmodes: enabling 'eve-log' module 'flow'
[65198] Info: logopenfile: stats output device (regular) initialized: stats.log
[65198] Config: landlock: Landlock is not enabled in configuration
[65198] Config: suricata: Delayed detect disabled
[65198] Config: detect: pattern matchers: MPM: ac, SPM: bm
[65198] Config: detect: grouping: tcp-whitelist (default) 53, 80, 139, 443, 445, 1433, 3306, 3389, 6666, 6667, 8080
[65198] Config: detect: grouping: udp-whitelist (default) 53, 135, 5060
[65198] Config: detect: prefilter engines: MPM
[65198] Config: reputation: IP reputation disabled
[65198] Config: detect: Loading rule file: /etc/suricata/rules/my.rules
[65198] Info: detect: 1 rule files processed. 1 rules successfully loaded, 0 rules failed, 0
[65198] Info: threshold-config: Threshold config parsed: 0 rule(s) found
[65198] Info: detect: 1 signatures processed. 0 are IP-only rules, 1 are inspecting packet payload, 0 inspect application layer, 0 are decoder event only
[65198] Config: detect: building signature grouping structure, stage 1: preprocessing rules... complete
[65198] Perf: detect: TCP toserver: 1 port groups, 1 unique SGH's, 0 copies
[65198] Perf: detect: TCP toclient: 0 port groups, 0 unique SGH's, 0 copies
[65198] Perf: detect: UDP toserver: 0 port groups, 0 unique SGH's, 0 copies
[65198] Perf: detect: UDP toclient: 0 port groups, 0 unique SGH's, 0 copies
[65198] Perf: detect: OTHER toserver: 0 proto groups, 0 unique SGH's, 0 copies
[65198] Perf: detect: OTHER toclient: 0 proto groups, 0 unique SGH's, 0 copies
[65198] Perf: detect: Unique rule groups: 1
[65198] Perf: detect: Builtin MPM "toserver TCP packet": 1
[65198] Perf: detect: Builtin MPM "toclient TCP packet": 0
[65198] Perf: detect: Builtin MPM "toserver TCP stream": 1
[65198] Perf: detect: Builtin MPM "toclient TCP stream": 0
[65198] Perf: detect: Builtin MPM "toserver UDP packet": 0
[65198] Perf: detect: Builtin MPM "toclient UDP packet": 0
[65198] Perf: detect: Builtin MPM "other IP packet": 0
[65198] Config: tmqh-flow: AutoFP mode using "Hash" flow load balancer
[65198] Config: flow-manager: using 1 flow manager threads
[65198] Config: flow-manager: using 1 flow recycler threads
[65204] Info: pcap: Starting file run for dump.pcapng
[65204] Info: pcap: pcap file dump.pcapng end of file reached (pcap err code 0)
[65198] Notice: threads: Threads created -> RX: 1 W: 4 FM: 1 FR: 1 Engine started.
[65198] Notice: suricata: Signal Received. Stopping engine.
[65198] Info: suricata: time elapsed 0.118s
[65210] Perf: flow-manager: 11 flows processed
[65204] Notice: pcap: read 1 file, 200 packets, 14388 bytes
[65198] Perf: tmqh-flow: AutoFP - Total flow handler queues - 4
[65198] Info: counters: Alerts: 0
[65198] Perf: ippair: ippair memory usage: 414144 bytes, maximum: 16777216
[65198] Perf: host: host memory usage: 398144 bytes, maximum: 33554432
root@lxx:~/7.6/suricata-7.0.6# suricata -c /etc/suricata/suricata.yaml -r dump.pcapng -vvvvv
Warning: Invalid/No global_log_level assigned by user. Falling back on the default_log_level "Info"
Notice: suricata: This is Suricata version 7.0.5 RELEASE running in USER mode [LogVersion:suricata.c:1146]
Info: cpu: CPUs/cores online: 4 [UtilCpuPrintSummary:util-cpu.c:182]
Info: suricata: Setting engine mode to IDS mode by default [PostConfLoadedSetup:suricata.c:2682]
Info: exception-policy: master exception-policy set to: auto [ExceptionPolicyMasterParse:util-exception-policy.c:200]
Notice: s7comm: Rust s7comm parser registered. [suricata::applayers7comm::s7comm::rs_s7comm_register_parser:s7comm.rs:442]
Notice: output-json-s7comm: S7comm JSON logger registered. [JsonS7commLogRegister:output-json-s7comm.c:172]
Info: logopenfile: fast output device (regular) initialized: fast.log [SCConfLogOpenGeneric:util-logopenfile.c:617]
Info: logopenfile: eve-log output device (regular) initialized: eve.json [SCConfLogOpenGeneric:util-logopenfile.c:617]
Notice: output-json-s7comm: S7comm log sub-module initialized. [OutputS7commLogInitSub:output-json-s7comm.c:119]
Notice: output-json-s7comm: S7comm log sub-module initialized. [OutputS7commLogInitSub:output-json-s7comm.c:119]
Info: logopenfile: stats output device (regular) initialized: stats.log [SCConfLogOpenGeneric:util-logopenfile.c:617]
Info: detect: 1 rule files processed. 1 rules successfully loaded, 0 rules failed, 0 [SigLoadSignatures:detect-engine-loader.c:363]
Info: threshold-config: Threshold config parsed: 0 rule(s) found [SCThresholdConfParseFile:util-threshold-config.c:1045]
Info: detect: 1 signatures processed. 0 are IP-only rules, 1 are inspecting packet payload, 0 inspect application layer, 0 are decoder event only [SigAddressPrepareStage1:detect-engine-build.c:1499]
Info: pcap: Starting file run for dump.pcapng [ReceivePcapFileLoop:source-pcap-file.c:179]
Info: pcap: pcap file dump.pcapng end of file reached (pcap err code 0) [PcapFileDispatch:source-pcap-file-helper.c:163]
Notice: threads: Threads created -> RX: 1 W: 4 FM: 1 FR: 1 Engine started. [TmThreadWaitOnThreadRunning:tm-threads.c:1901]
Notice: suricata: Signal Received. Stopping engine. [SuricataMainLoop:suricata.c:2806]
Info: suricata: time elapsed 0.190s [SCPrintElapsedTime:suricata.c:1166]
Notice: pcap: read 1 file, 200 packets, 14388 bytes [ReceivePcapFileThreadExitStats:source-pcap-file.c:388]
Info: counters: Alerts: 0 [StatsLogSummary:counters.c:878]
I have already followed the recommendations in the video, but the problem still persists. In the video, when running python3 scripts/setup-app-layer.py --detect --logger --parser --rust S7comm S7commbuf
, there is an error with the --rust
option.