-
Notifications
You must be signed in to change notification settings - Fork 11
/
chaos.sh
41 lines (24 loc) · 784 Bytes
/
chaos.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
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
input="companyName.txt"
while IFS= read -r line
do
curl -s https://chaos-data.projectdiscovery.io/"$line".zip -o "$line"/"$line".zip --create-dirs
find "$line"/ -iname "*.txt" | egrep '.*'
if [[ $? -eq 0 ]]; then
echo "There are some txt found. Renaming..."
for file in "$line"/*.txt
do
mv "$file" "${file/.txt/.txt_old}"
done
else
echo "There isn't any txt found."
fi
unzip "$line"/"$line".zip -d "$line"/
echo "Unzipped"
find "$line"/ -name '*.txt' -exec grep -Fxvf {}_old {} \; >> "$line"/differences.diff
find "$line"/ -name '*.txt' -exec sh -c 'sort -u $1 $1_old > $1_old' sh {} "$line" \;
echo "Merged new files with old ones"
echo "deleting new files after merge"
rm "$line"/*.txt
rm "$line"/*.zip
done < "$input"