Skip to content

Commit

Permalink
First Udate
Browse files Browse the repository at this point in the history
  • Loading branch information
happylie committed Aug 24, 2022
1 parent 64a26c7 commit b7d57f1
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 1 deletion.
62 changes: 61 additions & 1 deletion README.md
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
```
1 change: 1 addition & 0 deletions util/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# -*- coding: utf-8 -*-
46 changes: 46 additions & 0 deletions util/url_parser.py
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

0 comments on commit b7d57f1

Please # to comment.