-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathcheck_obfuscated_python.sh
More file actions
23 lines (23 loc) · 972 Bytes
/
check_obfuscated_python.sh
File metadata and controls
23 lines (23 loc) · 972 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
unarmored_count=0
armored_count=0
folders_to_check="/opt/ros"
for folder in $folders_to_check; do
python_files=()
python_files=($(find $folder -type f -path "*sr_*" -not -name '*.py' -exec grep -R -I -P '^#!/usr/bin/env python|^#! /usr/bin/env python|^#!/usr/bin/python|^#! /usr/bin/python' -l {} \;))
python_files+=($(find $folder -type f -path "*sr_*" -name '*.py' -not -name "*.pc.py" -not -name "*__init__.py*"))
for file in "${python_files[@]}"
do
check=$(cat $file | grep "__pyarmor__")
if [[ "$check" == "" ]]; then
echo "Not pyarmored: $file"
((unarmored_count++))
else
((armored_count++))
fi
done
done
if [ $unarmored_count -gt 0 ];then
echo "$unarmored_count non-pyarmored python files found, please check them manually to make sure they are not sensitive. $armored_count pyarmored files found."
else
echo "All senstivite python files are pyarmored. $armored_count pyarmored files found."
fi