-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·90 lines (86 loc) · 3.73 KB
/
install.sh
File metadata and controls
executable file
·90 lines (86 loc) · 3.73 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/usr/bin/env bash
APIKEY=$1
if [[ -z $APIKEY ]]
then
echo 'ERROR: please provide your API key as a parameter like:'
echo './install.sh MY_API_KEY'
exit 1
fi
if [[ -f "/etc/debian_version" || -f "/etc/lsb-release" ]]
then
echo "*** Installing dependencies for Ubuntu/Debian/Kali..."
sudo apt-get install cpanminus libmojolicious-perl libtie-ixhash-perl
sudo apt-get install liblwp-protocol-https-perl libjson-xs-perl libfile-slurp-perl
sudo apt-get install libregexp-ipv6-perl libtext-csv-xs-perl
sudo cpanm -n Config::INI::Tiny Text::ParseWords Net::IPv4Addr Regexp::IPv4
echo "*** Installing dependencies for Ubuntu/Debian/Kali...done"
echo ''
if [[ ! -f ~/.onyphe.ini ]]
then
echo "*** Creating .onyphe.ini squeleton..."
echo '# General APIs:' > ~/.onyphe.ini
echo 'api_endpoint = https://www.onyphe.io/api/v2' >> ~/.onyphe.ini
echo "api_key = $APIKEY" >> ~/.onyphe.ini
echo '' >> ~/.onyphe.ini
echo '# Unrated General APIs option:' >> ~/.onyphe.ini
echo '#api_unrated_endpoint = https://www.onyphe.io/unrated/api/v2' >> ~/.onyphe.ini
echo '#api_unrated_email = youremail@yourdomain.lan' >> ~/.onyphe.ini
echo '' >> ~/.onyphe.ini
echo '# Ondemand APIs:' >> ~/.onyphe.ini
echo 'api_ondemand_endpoint = https://www.onyphe.io/api/v3' >> ~/.onyphe.ini
echo "api_ondemand_key = $APIKEY" >> ~/.onyphe.ini
echo '' >> ~/.onyphe.ini
echo '# ASD APIs:' >> ~/.onyphe.ini
echo 'api_asd_endpoint = https://www.onyphe.io/api/v1' >> ~/.onyphe.ini
echo "api_asd_key = $APIKEY" >> ~/.onyphe.ini
echo '' >> ~/.onyphe.ini
echo '# Tunables:' >> ~/.onyphe.ini
echo 'api_maxpage = 1000' >> ~/.onyphe.ini
echo '#api_size = 100' >> ~/.onyphe.ini
echo '#api_trackquery = 1' >> ~/.onyphe.ini
echo '#api_calculated = 1' >> ~/.onyphe.ini
echo '#api_keepalive = 0' >> ~/.onyphe.ini
echo "*** Creating .onyphe.ini squeleton...done"
echo ''
fi
echo "*** Installing ONYPHE CLI Perl module..."
perl Build.PL
./Build && ./Build test
sudo ./Build install
echo "*** Installing ONYPHE CLI Perl module...done"
echo ''
echo 'Try the following query to verify everything works:'
echo "onyphe -search 'category:datascan domain:example.com'"
else
if [[ ! -f ~/.onyphe.ini ]]
then
echo "*** Creating .onyphe.ini squeleton..."
echo '# General APIs:' > ~/.onyphe.ini
echo 'api_endpoint = https://www.onyphe.io/api/v2' >> ~/.onyphe.ini
echo "api_key = $APIKEY" >> ~/.onyphe.ini
echo '' >> ~/.onyphe.ini
echo '# Unrated General APIs option:' >> ~/.onyphe.ini
echo '#api_unrated_endpoint = https://www.onyphe.io/unrated/api/v2' >> ~/.onyphe.ini
echo '#api_unrated_email = youremail@yourdomain.lan' >> ~/.onyphe.ini
echo '' >> ~/.onyphe.ini
echo '# Ondemand APIs:' >> ~/.onyphe.ini
echo 'api_ondemand_endpoint = https://www.onyphe.io/api/v3' >> ~/.onyphe.ini
echo "api_ondemand_key = $APIKEY" >> ~/.onyphe.ini
echo '' >> ~/.onyphe.ini
echo '# ASD APIs:' >> ~/.onyphe.ini
echo 'api_asd_endpoint = https://www.onyphe.io/api/v1' >> ~/.onyphe.ini
echo "api_asd_key = $APIKEY" >> ~/.onyphe.ini
echo '' >> ~/.onyphe.ini
echo '# Tunables:' >> ~/.onyphe.ini
echo 'api_maxpage = 1000' >> ~/.onyphe.ini
echo '#api_size = 100' >> ~/.onyphe.ini
echo '#api_trackquery = 1' >> ~/.onyphe.ini
echo '#api_calculated = 1' >> ~/.onyphe.ini
echo '#api_keepalive = 0' >> ~/.onyphe.ini
echo "*** Creating .onyphe.ini squeleton...done"
echo ''
fi
echo "ERROR: System unknown, can't install automatically:"
echo 'Please proceed with manual install as described in README file paragraph 2.'
fi
exit 0