-
Notifications
You must be signed in to change notification settings - Fork 3
/
install-shodan-cli.py
65 lines (49 loc) · 1.81 KB
/
install-shodan-cli.py
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
#!/usr/bin/env python
#This script guides the user through the various steps needed to install ShodanCLI
#Simply run this script and follow the prompts
import os
import signal
import sys
import time
import subprocess
import shlex
def API_key(*varargs):
print("Do you have your Shodan API key ready to go?\ny for yes; n for no")
key_ready=raw_input('')
if key_ready == 'y':
print("Cool - we can initialise it right now. Do you want to proceed?\ny for yes; n for no")
key_proceed=raw_input('')
if key_proceed == 'y':
print('Enter the key now:')
key_API=raw_input('')
print('Initilising now....')
subprocess.call(shlex.split("shodan init %key_API"))
elif key_proceed == 'n':
print("Ok - next time.")
else:
print("You dont know what you're missing :)\n Laterz!")
exit()
return;
print("Welcome to Shodan CLI installer!")
print("#########################################")
print("You need PIP installed for this to work - do you have PIP installed?\ny for yes; n for no")
#Get UserInput for PIP installation
pip_installed=raw_input('')
if pip_installed == 'y':
print("Cool. Moving to the next step.")
print("Starting the Shodan CLI install now....")
subprocess.call(shlex.split("pip install shodan"))
API_key()
elif pip_installed == 'n':
print("No worries, do you want to install it now?\ny for yes; n for no")
pip_get = raw_input('')
if pip_get == 'y':
print("Ok, let's get PIP installed.")
subprocess.call(shlex.split("sudo apt-get install python-pip"))
API_key()
elif pip_get == 'n':
print("Cool. Stopping the script now...")
exit()
else:
print("That is not an option dude... Pick y or n!")
exit()