File: b0ftaint.sh

package info (click to toggle)
graudit 4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,256 kB
  • sloc: sh: 1,134; makefile: 82; php: 62; jsp: 24
file content (15 lines) | stat: -rwxr-xr-x 551 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/sh
#testing C taint
echo 'char[[:space:]]+[a-zA-Z0-9\.\-\_][a-zA-Z0-9\.\-\_]+\[' | \
graudit -B -z -d /dev/stdin -c 0 $1 | \
perl -ne 'if ($_ =~ m/char\s+([a-zA-Z0-9\.\-\_]+)\[/) { print "$1\n"; }' | sort -u > /tmp/test
while read var; do
  echo "(memcpy|strcat|strcpy|sprintf).*$var"
done </tmp/test | \
graudit -B -z -d /dev/stdin -c 0 $1 | \
grep -o -f /tmp/test | sort -u > /tmp/taint
while read var; do
   echo "char[[:space:]]+[\*]?$var\["
   echo "(memcpy|strcat|strcpy|sprintf).*$var"
done </tmp/taint | \
graudit -c 3 -d /dev/stdin $1