-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
108 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,61 @@ | ||
# sslinfo | ||
# Search of SSL Certification Information(SoSCI) | ||
## Search of SSL Certification Information | ||
### SSL 인증서 정보 검색 | ||
- https://happylie.tistory.com | ||
|
||
### 설치 방법 | ||
1. Git Clone | ||
``` | ||
$ https://github.com/happylie/sosci.git | ||
``` | ||
|
||
### 실행 방법 | ||
1. Help | ||
``` | ||
$ python sosci.py -h | ||
usage: sosci.py [-h] [-u URL] [-e] [-v] | ||
Search of SSL Certification Information(SoSCI) | ||
optional arguments: | ||
-h, --help show this help message and exit | ||
-u URL, --url URL Check URL(HTTPS URL or Hostname) | ||
-e, --expire Certification Expire Date | ||
-v, --version show program's version number and exit | ||
``` | ||
|
||
2. Search of SSL Certification Information | ||
``` | ||
$ python sosci.py -u https://happylie.tistory.com | ||
{ | ||
"subject":{ | ||
"countryName":"KR", | ||
"stateOrProvinceName":"Jeju-do", | ||
"localityName":"Jeju-si", | ||
"organizationName":"Kakao Corp.", | ||
"commonName":"*.tistory.com" | ||
}, | ||
"issuer":{ | ||
"countryName":"US", | ||
"organizationName":"DigiCert Inc", | ||
"organizationalUnitName":"www.digicert.com", | ||
"commonName":"Thawte TLS RSA CA G1" | ||
}, | ||
"notBefore":"2022-03-14 00:00:00", | ||
"notAfter":"2023-03-31 23:59:59", | ||
"expireDate":"219 Days", | ||
"subjectAltName":{ | ||
"DNS":[ | ||
"*.tistory.com", | ||
"tistory.com" | ||
] | ||
} | ||
} | ||
``` | ||
|
||
3. Certification Expire Date | ||
``` | ||
$ python sosci.py -u https://happylie.tistory.com -e | ||
219 Days | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# -*- coding: utf-8 -*- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/usr/bin/python | ||
# -*- coding: utf-8 -*- | ||
from urllib.parse import urlparse | ||
from urllib.request import urlopen | ||
from urllib.error import HTTPError | ||
from urllib.error import URLError | ||
|
||
|
||
class UrlPaser: | ||
def __init__(self): | ||
self.a = "" | ||
|
||
@staticmethod | ||
def __url_check(url): | ||
try: | ||
with urlopen(url) as response: | ||
status_code = response.getcode() | ||
if status_code != 200: | ||
return False | ||
return True | ||
except HTTPError as err: | ||
return False | ||
except URLError as err: | ||
return False | ||
|
||
def get_parser(self, data): | ||
""" | ||
Get URL Parser | ||
:param data: Parse URL | ||
:return: True/False, host, port | ||
""" | ||
try: | ||
obj = urlparse(data) | ||
scheme = obj.scheme if obj.scheme else 'https' | ||
hostname = obj.hostname | ||
if not hostname: | ||
c_str = '{scheme}://{url}'.format(scheme=scheme, url=data) | ||
obj = urlparse(c_str) | ||
host = obj.hostname if obj.hostname else hostname | ||
port = obj.port if obj.port else 443 | ||
url = '{scheme}://{host}:{port}'.format(scheme=scheme, host=host, port=port) | ||
if not self.__url_check(url): | ||
return False, None, None | ||
return True, host, port | ||
except Exception as err: | ||
return False, None, None |