File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ def get_api_key():
5050
5151 # Make sure it is a read-only file
5252 os .chmod (keyfile , 0600 )
53-
53+
5454 with open (keyfile , 'r' ) as fin :
5555 return fin .read ().strip ()
5656
@@ -85,10 +85,13 @@ def init(key):
8585 raise click .ClickException ('Unable to create directory to store the Shodan API key (%s)' % shodan_dir )
8686
8787 # Store the API key in the user's directory
88- with open (shodan_dir + '/api_key' , 'w' ) as fout :
88+ keyfile = shodan_dir + '/api_key'
89+ with open (keyfile , 'w' ) as fout :
8990 fout .write (key .strip ())
9091 click .echo (click .style ('Successfully initialized' , fg = 'green' ))
9192
93+ os .chmod (keyfile , 0600 )
94+
9295
9396@main .command ()
9497@click .argument ('query' , metavar = '<search query>' , nargs = - 1 )
You can’t perform that action at this time.
0 commit comments