Spaces:
Running
Running
Upload 3 files
Browse files- app.py +9 -0
- matcher.py +34 -0
- requirements.txt +1 -0
app.py
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from matcher import fetch_data
|
3 |
+
|
4 |
+
def get_status(csrpvt, cert):
|
5 |
+
status = fetch_data(csrpvt, cert)
|
6 |
+
return status
|
7 |
+
|
8 |
+
app = gr.Interface(fn=fetch_data, inputs=["textbox", "textbox"], outputs="textbox")
|
9 |
+
app.launch()
|
matcher.py
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import requests
|
2 |
+
from urllib.parse import quote
|
3 |
+
|
4 |
+
def data(csrpvt, cert):
|
5 |
+
newcsrpvt = quote(csrpvt)
|
6 |
+
newcert = quote(cert)
|
7 |
+
input_data = f"MatcherForm%5Bssl_cert%5D={newcert}&CsrOrPrivat_cert=&MatcherForm%5Bother_cert%5D={newcsrpvt}"
|
8 |
+
return input_data
|
9 |
+
|
10 |
+
# Define the function to make the POST request
|
11 |
+
def fetch_data(csrpvt, cert):
|
12 |
+
input_data = data(csrpvt, cert)
|
13 |
+
url = "https://www.sslchecker.com/matcher"
|
14 |
+
headers = {
|
15 |
+
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
|
16 |
+
"Accept-Language": "en-IN,en-GB;q=0.9,en-US;q=0.8,en;q=0.7",
|
17 |
+
"Cache-Control": "max-age=0",
|
18 |
+
"Content-Type": "application/x-www-form-urlencoded",
|
19 |
+
"Referer": "https://www.sslchecker.com/matcher",
|
20 |
+
"Referrer-Policy": "strict-origin-when-cross-origin"
|
21 |
+
}
|
22 |
+
response = requests.post(url, headers=headers, data=input_data)
|
23 |
+
if response.ok:
|
24 |
+
html = response.text
|
25 |
+
from bs4 import BeautifulSoup
|
26 |
+
soup = BeautifulSoup(html, 'html.parser')
|
27 |
+
span_element = soup.select_one('.info-block3.ok > div > span')
|
28 |
+
if span_element:
|
29 |
+
extracted_text = span_element.get_text(strip=True)
|
30 |
+
return extracted_text
|
31 |
+
else:
|
32 |
+
return "CSR/Private Key and Certificate do not match"
|
33 |
+
else:
|
34 |
+
print('There was a problem with the fetch operation:', response.status_code)
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
gradio==4.41.0
|