Skip to content

Commit

Permalink
remove unnecessary request.
Browse files Browse the repository at this point in the history
Codes shown below seems duplicate and unnecessary.
```
ctx = ssl._create_unverified_context()
s = ctx.wrap_socket(socket.socket(), server_hostname=hostname)
s.connect((hostname, 443))
info = s.getpeercert(True)
```
  • Loading branch information
def-fun authored Mar 29, 2020
1 parent 5c133eb commit b8f933d
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions modules/sslinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ def cert(hostname, output, data):
s.connect((hostname, 443))
info = s.getpeercert()
except:
ctx = ssl._create_unverified_context()
s = ctx.wrap_socket(socket.socket(), server_hostname=hostname)
s.connect((hostname, 443))
info = s.getpeercert(True)
info = ssl.get_server_certificate((hostname, 443))
f = open('{}.pem'.format(hostname), 'w')
f.write(info)
Expand Down Expand Up @@ -77,4 +73,4 @@ def unpack(v, pair):
cert_output(output, data, result)

def cert_output(output, data, result):
data['module-SSL Certificate Information'] = result
data['module-SSL Certificate Information'] = result

0 comments on commit b8f933d

Please sign in to comment.