Skip to content

Commit 3e9ca3e

Browse files
committed
Adds tcpdump project
1 parent f585b66 commit 3e9ca3e

File tree

3 files changed

+73
-0
lines changed

3 files changed

+73
-0
lines changed

projects/tcpdump/Dockerfile

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Copyright 2018 Google Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
################################################################################
16+
17+
FROM gcr.io/oss-fuzz-base/base-builder
18+
19+
RUN apt-get update && apt-get install -y make cmake flex bison
20+
RUN git clone --depth=1 https://github.com/the-tcpdump-group/libpcap.git libpcap
21+
#TODO use main repo
22+
RUN git clone --depth=1 --branch fuzz https://github.com/catenacyber/tcpdump.git tcpdump
23+
WORKDIR $SRC
24+
COPY build.sh $SRC/

projects/tcpdump/build.sh

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash -eu
2+
# Copyright 2018 Google Inc.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
################################################################################
17+
18+
cd libpcap
19+
mkdir build
20+
cd build
21+
cmake ..
22+
make
23+
make install
24+
25+
cd ../../tcpdump
26+
# build project
27+
mkdir build
28+
cd build
29+
cmake ..
30+
make
31+
32+
# build fuzz targets
33+
$CC $CFLAGS -I.. -I. -c ../fuzz/fuzz_pcap.c -o fuzz_pcap.o
34+
$CXX $CXXFLAGS fuzz_pcap.o -o $OUT/fuzz_pcap libnetdissect.a ../../libpcap/build/libpcap.a -lFuzzingEngine
35+
36+
# export other associated stuff
37+
cd ..
38+
cp fuzz/fuzz_*.options $OUT/
39+
#builds corpus
40+
zip -r fuzz_pcap_seed_corpus.zip tests/*.pcap
41+
cp fuzz_pcap_seed_corpus.zip $OUT/

projects/tcpdump/project.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
homepage: "https://www.tcpdump.org"
2+
primary_contact: "[email protected]"
3+
auto_ccs : "[email protected]"
4+
5+
sanitizers:
6+
- address
7+
- memory
8+
- undefined

0 commit comments

Comments
 (0)