-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscanner.sh
29 lines (24 loc) · 1.07 KB
/
scanner.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
# Get current datetime with unique random number
echo “Getting current datetime with unique random number”
current_time=$(date “+%Y_%m_%d_%H_%N”)
copy_file=“$current_time”_new_repos.txt
# Copy new_repos.txt to copy_file
echo “Copying new_repos.txt to copy_file”
cp new_repos.txt ./output/“$copy_file”
# Iterate over the repos in copy_file and run trufflehog
echo “Running trufflehog with --json flag for each repo”
for repo in $(cat ./output/$copy_file); do
# Set output file name
output_file=“$current_time”_“$RANDOM”_truffle
# Run trufflehog with --json flag and save output in output_file
echo “Running trufflehog with --json flag for repo: $repo”
trufflehog --json git “$repo” --no-update >> ./output/“$output_file”
# Check if DetectorName is present in the output file
if grep -q “DetectorName” ./output/$output_file; then
cat ./output/$output_file | notify -id gitalert
fi
done
# Delete copy_file
echo “Deleting copy_file”
rm “./output/$copy_file”