Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cwe_checker
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fact-depend
cwe_checker
Commits
87b088ed
Commit
87b088ed
authored
Nov 21, 2018
by
Peter Weidenbach
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring
parent
1176088a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
19 deletions
+30
-19
.gitignore
.gitignore
+3
-0
Dockerfile
Dockerfile
+9
-10
CweCheckerParser.py
cwe_checker_to_ida/CweCheckerParser.py
+18
-9
No files found.
.gitignore
View file @
87b088ed
...
@@ -209,3 +209,6 @@ test/real_world_samples
...
@@ -209,3 +209,6 @@ test/real_world_samples
test/run_real_world_samples.sh
test/run_real_world_samples.sh
# End of https://www.gitignore.io/api/c,ocaml,python
# End of https://www.gitignore.io/api/c,ocaml,python
.project
.pydevproject
Dockerfile
View file @
87b088ed
# based on https://github.com/BinaryAnalysisPlatform/bap/blob/master/docker/Dockerfile
# based on https://github.com/BinaryAnalysisPlatform/bap/blob/master/docker/Dockerfile
FROM
ubuntu:bionic
FROM
phusion/baseimage:0.11
MAINTAINER
Thomas Barabosch <thomas.barabosch@fkie.fraunhofer.de>
RUN
apt-get
-y
update
&&
apt-get
-y
install
\
RUN
apt-get
-y
update
&&
apt-get
-y
install
\
build-essential
\
build-essential
\
curl
\
curl
\
...
@@ -12,14 +11,15 @@ RUN apt-get -y update && apt-get -y install \
...
@@ -12,14 +11,15 @@ RUN apt-get -y update && apt-get -y install \
software-properties-common
\
software-properties-common
\
sudo
\
sudo
\
unzip
\
unzip
\
wget
wget
\
RUN
apt-get
-y
install
\
binutils-multiarch
\
binutils-multiarch
\
clang
\
clang
\
libgmp-dev
\
libgmp-dev
\
libzip-dev
\
libzip-dev
\
llvm-6.0-dev
\
llvm-6.0-dev
\
zlib1g-dev
zlib1g-dev
\
&&
apt-get clean
\
&&
rm
-rf
/var/lib/apt/lists/
*
RUN
wget https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh
RUN
wget https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh
RUN
yes /usr/local/bin | sh install.sh
RUN
yes /usr/local/bin | sh install.sh
RUN
useradd
-m
bap
&&
echo
"bap:bap"
| chpasswd
&&
adduser bap
sudo
RUN
useradd
-m
bap
&&
echo
"bap:bap"
| chpasswd
&&
adduser bap
sudo
...
@@ -35,14 +35,13 @@ RUN opam repo add bap opam-repository
...
@@ -35,14 +35,13 @@ RUN opam repo add bap opam-repository
RUN
opam update
RUN
opam update
RUN
opam install depext
--yes
RUN
opam install depext
--yes
RUN
OPAMJOBS
=
1 opam depext
--install
bap
--yes
RUN
OPAMJOBS
=
1 opam depext
--install
bap
--yes
RUN
sudo
-EH
pip install bap
RUN
pip install bap
# install CWE_Checker and dependencies
# install CWE_Checker and dependencies
RUN
OPAMJOBS
=
1 opam install yojson alcotest
--yes
RUN
OPAMJOBS
=
1 opam install yojson alcotest
--yes
COPY
. /home/bap/cwe_checker/
COPY
. /home/bap/cwe_checker/
RUN
sudo
chown
-R
bap:bap /home/bap/cwe_checker
RUN
sudo
chown
-R
bap:bap /home/bap/cwe_checker
ENV
PATH="/home/bap/.opam/4.05.0/bin/:${PATH}"
ENV
PATH="/home/bap/.opam/4.05.0/bin/:${PATH}"
RUN
cd
/home/bap/cwe_checker/src
;
\
WORKDIR
/home/bap/cwe_checker/src
bapbuild
-r
-Is
checkers,utils
-pkgs
yojson,unix cwe_checker.plugin
;
\
RUN
bapbuild
-r
-Is
checkers,utils
-pkgs
yojson,unix cwe_checker.plugin
;
\
bapbundle install cwe_checker.plugin
;
\
bapbundle install cwe_checker.plugin
;
cd
-
ENTRYPOINT
["opam", "config", "exec", "--"]
ENTRYPOINT
["opam", "config", "exec", "--"]
cwe_checker_to_ida/CweCheckerParser.py
View file @
87b088ed
...
@@ -85,42 +85,51 @@ class Parser(object):
...
@@ -85,42 +85,51 @@ class Parser(object):
raise
Exception
()
raise
Exception
()
return
lines
return
lines
def
_not_highlighted
(
self
,
warning
):
@staticmethod
def
_not_highlighted
(
warning
):
warning
.
highlight
=
False
warning
.
highlight
=
False
return
warning
return
warning
def
_parse_at
(
self
,
warning
):
@staticmethod
def
_parse_at
(
warning
):
warning
.
address
=
warning
.
warning
.
split
(
"at "
)[
-
1
]
.
split
()[
0
]
.
strip
()
warning
.
address
=
warning
.
warning
.
split
(
"at "
)[
-
1
]
.
split
()[
0
]
.
strip
()
return
warning
return
warning
def
_parse_cwe190
(
self
,
warning
):
@staticmethod
def
_parse_cwe190
(
warning
):
if
"multiplication"
in
warning
.
warning
:
if
"multiplication"
in
warning
.
warning
:
warning
.
address
=
warning
.
warning
.
split
(
"multiplication "
)[
1
]
.
split
()[
0
]
warning
.
address
=
warning
.
warning
.
split
(
"multiplication "
)[
1
]
.
split
()[
0
]
else
:
else
:
warning
.
address
=
warning
.
warning
.
split
(
"addition "
)[
1
]
.
split
()[
0
]
warning
.
address
=
warning
.
warning
.
split
(
"addition "
)[
1
]
.
split
()[
0
]
return
warning
return
warning
def
_parse_cwe457
(
self
,
warning
):
@staticmethod
def
_parse_cwe457
(
warning
):
warning
.
address
=
warning
.
warning
.
split
(
"at "
)[
-
1
]
.
split
(
":"
)[
0
]
.
strip
()
warning
.
address
=
warning
.
warning
.
split
(
"at "
)[
-
1
]
.
split
(
":"
)[
0
]
.
strip
()
return
warning
return
warning
def
_parse_cwe467
(
self
,
warning
):
@staticmethod
def
_parse_cwe467
(
warning
):
warning
.
address
=
warning
.
warning
.
split
(
"at "
)[
1
]
.
split
()[
0
]
warning
.
address
=
warning
.
warning
.
split
(
"at "
)[
1
]
.
split
()[
0
]
return
warning
return
warning
def
_parse_cwe476
(
self
,
warning
):
@staticmethod
def
_parse_cwe476
(
warning
):
warning
.
address
=
warning
.
warning
.
split
(
"at "
)[
1
]
.
split
()[
0
]
warning
.
address
=
warning
.
warning
.
split
(
"at "
)[
1
]
.
split
()[
0
]
return
warning
return
warning
def
_parse_cwe676
(
self
,
warning
):
@staticmethod
def
_parse_cwe676
(
warning
):
warning
.
address
=
warning
.
warning
.
split
(
"("
)[
1
]
.
split
(
")"
)[
0
]
.
split
(
":"
)[
0
]
warning
.
address
=
warning
.
warning
.
split
(
"("
)[
1
]
.
split
(
")"
)[
0
]
.
split
(
":"
)[
0
]
return
warning
return
warning
def
_parse_cwe782
(
self
,
warning
):
@staticmethod
def
_parse_cwe782
(
warning
):
warning
.
address
=
warning
.
warning
.
spit
(
"("
)[
1
]
.
split
(
")"
)[
0
]
.
strip
()
warning
.
address
=
warning
.
warning
.
spit
(
"("
)[
1
]
.
split
(
")"
)[
0
]
.
strip
()
return
warning
return
warning
def
_extract_cwe_number
(
self
,
name
):
@staticmethod
def
_extract_cwe_number
(
name
):
tmp
=
name
.
split
(
"]"
)[
0
]
tmp
=
name
.
split
(
"]"
)[
0
]
return
tmp
[
1
:]
return
tmp
[
1
:]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment