Committer: root <root@fruw.org>
This commit is contained in:
21
shell/vt/LICENSE
Normal file
21
shell/vt/LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 Mitch Conner
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
6
shell/vt/README.md
Normal file
6
shell/vt/README.md
Normal file
@ -0,0 +1,6 @@
|
||||
### vt
|
||||
Сверяет хэш файла с БД и выводит результат.
|
||||
```
|
||||
Малварь не найдена.
|
||||
Файл - тип файла.
|
||||
```
|
25
shell/vt/vt.sh
Normal file
25
shell/vt/vt.sh
Normal file
@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
apikey=c2fe3b4dc0b284ff2bd7cd08a361e134bc01c6a19a61536a4e514185fb8c37df
|
||||
md5=$(md5sum "$1" | sed -r "s/ .+$//")
|
||||
resp=$(curl --request GET \
|
||||
--url https://www.virustotal.com/api/v3/files/{"$md5"} \
|
||||
--header "x-apikey: "$apikey"" 2>/dev/null)
|
||||
mlwr=$(echo "$resp" | jq '.data .attributes .total_votes .malicious')
|
||||
numb=$(ls /dev/pts)
|
||||
gnome-terminal &
|
||||
sleep .1
|
||||
numb=$(ls /dev/pts)$(printf "\n$numb")
|
||||
numb=$(echo "$numb" | sort | uniq -u)
|
||||
if [[ "$mlwr" == "null" ]]; then
|
||||
out=$(echo "Хэш не найден!")
|
||||
elif [[ "$mlwr" == "0" ]]; then
|
||||
out=$(echo "Малварь не найдена.")
|
||||
else
|
||||
body=$(echo "$resp" | jq '.data .attributes .last_analysis_results | .[] | "\(.engine_name) \(.result)"' \
|
||||
| sed 's/ /: /' | sed 's/"$//' | sed 's/"//' | sed -r '/null$/d')
|
||||
out=$(printf "%s\n\nАнтивирусы, нашедшие малварь ↑\nВсего найдено малварей: %s\n" \
|
||||
"$body" "$mlwr")
|
||||
fi
|
||||
ih=$(echo "$1 - " | sed -r 's/.+\///')
|
||||
ib=$(file "$1" | sed -r 's/.+: //' | sed -r 's/,.+$//')
|
||||
printf "$out\n$ih$ib" > /dev/pts/"$numb"
|
Reference in New Issue
Block a user