Skip to content

Instantly share code, notes, and snippets.

@Xnuvers007
Last active November 6, 2023 19:00
Show Gist options
  • Save Xnuvers007/1cb0bdc2aeb52b9b014f0fa6933b2c47 to your computer and use it in GitHub Desktop.
Save Xnuvers007/1cb0bdc2aeb52b9b014f0fa6933b2c47 to your computer and use it in GitHub Desktop.
periksa data / data breach checker with python credit : https://periksadata.com/
import requests, time
from bs4 import BeautifulSoup
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/119.0',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8',
'Accept-Language': 'id,en-US;q=0.7,en;q=0.3',
'Content-Type': 'application/x-www-form-urlencoded',
'Origin': 'https://periksadata.com',
'Alt-Used': 'periksadata.com',
'Connection': 'keep-alive',
'Referer': 'https://periksadata.com/',
'Upgrade-Insecure-Requests': '1',
'Sec-Fetch-Dest': 'document',
'Sec-Fetch-Mode': 'navigate',
'Sec-Fetch-Site': 'same-origin',
'Sec-Fetch-User': '?1',
}
e_mail = str(input("Masukan email : "))
data = 'email='+e_mail
while True:
#response = requests.post('https://periksadata.com/', cookies=cookies, headers=headers, data=data)
response = requests.post('https://periksadata.com/', headers=headers, data=data)
if response.status_code == 200:
soup = BeautifulSoup(response.text, 'html.parser')
paragraf = soup.find_all('div', class_='col-md-6')
if any(paragraf):
for p in paragraf:
title_element = p.find('h5')
if title_element is not None:
title = title_element.text.strip()
paragraphs = p.find_all('p')
print(title)
#print("https://periksadata.com" + p.find('a')['href'])
link2 = "https://periksadata.com" + p.find('a')['href']
print(link2)
response2 = requests.get(link2, headers=headers)
soup2 = BeautifulSoup(response2.text, 'html.parser')
# paragraphs2 = soup2.find('div', class_='col-md-10 col-lg-8')
#print(soup2.find('p', class_='lead'))
lead_paragraph = soup2.find('p', class_='lead')
if lead_paragraph is not None:
print("Deskripsi : "+lead_paragraph.text.strip()[:-45])
else:
print('No lead paragraph found')
# print(paragraphs2)
# print(soup2.find('span', class_='label label--inline text-center rounded').text.strip())
# data_leaked = soup2.find('span').text.strip()
# for leak in data_leaked:
# print(leak)
data_leaked = soup2.find_all('span', class_='label label--inline text-center rounded')
# for leak in data_leaked:
# print(leak.text.strip())
data_leaked_text = ' '.join(leak.text.strip() for leak in data_leaked)
# print(f'Data yang bocor: {data_leaked_text}')
for para in paragraphs:
parts = para.find_all('b')
if len(parts) >= 2:
label = parts[0].text.strip()
# value = parts[1].text.strip()
datas = parts[2].text.strip()
print(f'Tanggal Kejadian: {label}\nData yang bocor: {data_leaked_text}\nTotal keseluruhan data yang bocor: {datas}')
print()
break
print(f"Request failed, waiting for 5 seconds before retrying...")
time.sleep(5)
from flask import Flask, request, jsonify
import requests
from bs4 import BeautifulSoup
from fake_useragent import UserAgent
from email_validator import validate_email, EmailNotValidError
app = Flask(__name__)
user_agent = UserAgent()
random_user_agent = user_agent.random
@app.route('/checkdata', methods=['GET'])
def check_data():
email = request.args.get('email')
if not email:
return jsonify({'error': 'Email is required',
'path': request.host_url + '[email protected]'
})
try:
valid = validate_email(email)
email = valid.email
except EmailNotValidError as e:
# return jsonify({'error': "Invalid email address"})
pass
headers = {
'User-Agent': random_user_agent,
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8',
'Accept-Language': 'id,en-US;q=0.7,en;q=0.3',
'Content-Type': 'application/x-www-form-urlencoded',
'Origin': 'https://periksadata.com',
'Alt-Used': 'periksadata.com',
'Connection': 'keep-alive',
'Referer': 'https://periksadata.com',
'Upgrade-Insecure-Requests': '1',
'Sec-Fetch-Dest': 'document',
'Sec-Fetch-Mode': 'navigate',
'Sec-Fetch-Site': 'same-origin',
'Sec-Fetch-User': '?1',
}
data = f'email={email}'
response = requests.post('https://periksadata.com', headers=headers, data=data)
data_json = {'results': []}
if response.status_code == 200:
soup = BeautifulSoup(response.text, 'html.parser')
paragraphs = soup.find_all('div', class_='col-md-6')
for p in paragraphs:
title_element = p.find('h5')
if title_element:
title = title_element.text.strip()
link = 'https://periksadata.com' + p.find('a')['href']
response2 = requests.get(link, headers=headers)
soup2 = BeautifulSoup(response2.text, 'html.parser')
lead_paragraph = soup2.find('p', class_='lead')
if lead_paragraph:
description = lead_paragraph.text.strip()[:-45]
else:
description = 'No lead paragraph found'
data_leaked = soup2.find_all('span', class_='label label--inline text-center rounded')
data_leaked_text = ' , '.join(leak.text.strip() for leak in data_leaked)
paragraphs = p.find_all('p')
data = []
for para in paragraphs:
parts = para.find_all('b')
if len(parts) >= 2:
label = parts[0].text.strip()
datas = parts[2].text.strip()
data.append({'Tanggal Kejadian': label, 'Data yang bocor': data_leaked_text, 'Total keseluruhan data yang bocor': datas})
result = {
'title': title,
'link': link,
'description': description,
'data': data,
}
data_json['results'].append(result)
return jsonify({"User-Agent": random_user_agent, "Email": email, "Data": data_json})
else:
return jsonify({'error': 'Request failed'})
if __name__ == '__main__':
app.run(debug=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment