-
Notifications
You must be signed in to change notification settings - Fork 289
/
run.sh
executable file
·57 lines (49 loc) · 1.17 KB
/
run.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/sh
current_time=$(date "+%Y.%m.%d-%H.%M")
if [[ -z $upload ]]
then
root_dir=/shared/
else
root_dir=/
mkdir /xml_files
mkdir /reports
fi
report_extension="tex"
if [[ ! -z $format ]]
then
report_extension=$format
fi
xml_dir=xml_files/$current_time
report_file=reports/report_$current_time.$report_extension
function upload {
if [[ -z $upload ]]
then
return
elif [ $upload = "aws" ]
then
python /aws_push.py $1
elif [ $upload = "gcp" ]
then
python /gcp_push.py $1
fi
}
function get_filename(){
echo $1 | tr / -
}
mkdir $root_dir$xml_dir
while IFS= read -r line
do
current_time=$(date "+%Y.%m.%d-%H.%M.%S")
filename=$(get_filename $line)".xml"
nmap -sV -oX $root_dir$xml_dir/$filename -oN - -v1 $@ --script=vulners/vulners.nse $line
upload $xml_dir/$filename
done < /shared/ips.txt
python /output_report.py $root_dir$xml_dir $root_dir$report_file /shared/ips.txt
if [[ $report_extension = "tex" ]]
then
sed -i 's/_/\\_/g' $root_dir$report_file
sed -i 's/\$/\\\$/g' $root_dir$report_file
sed -i 's/#/\\#/g' $root_dir$report_file
sed -i 's/%/\\%/g' $root_dir$report_file
fi
upload $report_file