Add basic schema

pull/2099/head
Paul Pfeister 2 weeks ago
parent 58a2cc9c43
commit 198798d28b

@ -1,4 +1,5 @@
{
"$schema": "data.schema.json",
"1337x": {
"errorMsg": [
"<title>Error something went wrong.</title>",
@ -479,8 +480,7 @@
"url": "https://codeforces.com/profile/{}",
"urlMain": "https://codeforces.com/",
"urlProbe": "https://codeforces.com/api/user.info?handles={}",
"username_claimed": "tourist",
"username_unclaimed": "noonewouldeverusethis7"
"username_claimed": "tourist"
},
"Codepen": {
"errorType": "status_code",
@ -1072,8 +1072,7 @@
"errorUrl": "https://irc-galleria.net/users/search?username={}",
"url": "https://irc-galleria.net/user/{}",
"urlMain": "https://irc-galleria.net/",
"username_claimed": "appas",
"username_unclaimed": "noonewouldeverusethis77"
"username_claimed": "appas"
},
"Icons8 Community": {
"errorType": "status_code",
@ -1160,7 +1159,6 @@
},
"Jimdo": {
"errorType": "status_code",
"noPeriod": "True",
"regexCheck": "^[a-zA-Z0-9@_-]$",
"url": "https://{}.jimdosite.com",
"urlMain": "https://jimdosite.com/",
@ -1334,8 +1332,7 @@
"url": "https://monkeytype.com/profile/{}",
"urlMain": "https://monkeytype.com/",
"urlProbe": "https://api.monkeytype.com/users/{}/profile",
"username_claimed": "Lost_Arrow",
"username_unclaimed": "noonewouldeverusethis7"
"username_claimed": "Lost_Arrow"
},
"Motherless": {
"errorMsg": "no longer a member",

@ -0,0 +1,60 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Sherlock Targets",
"description": "Social media target to probe for existence of usernames",
"type": "object",
"patternProperties": {
"^(?!\\$).*?$": {
"type": "object",
"required": [ "url", "urlMain", "errorType", "username_claimed" ],
"properties": {
"url": { "type": "string" },
"urlMain": { "type": "string" },
"urlProbe": { "type": "string" },
"username_claimed": { "type": "string" },
"regexCheck": { "type": "string" },
"isNSFW": { "type": "boolean" },
"headers": { "type": "object" },
"request_payload": { "type": "object" },
"tags": {
"oneOf": [
{
"type": "string",
"enum": [ "adult", "gaming" ]
},
{
"type": "array",
"items": {
"type": "string",
"enum": [ "adult", "gaming" ]
}
}
]
},
"request_method": {
"type": "string",
"enum": [ "GET", "POST", "HEAD" ]
},
"errorType": {
"type": "string",
"enum": [ "message", "response_url", "status_code" ]
},
"errorMsg": {
"oneOf": [
{ "type": "string" },
{ "type": "array", "items": { "type": "string" } }
]
},
"errorCode": {
"oneOf": [
{ "type": "integer" },
{ "type": "array", "items": { "type": "integer" } }
]
},
"errorUrl": { "type": "string" },
"response_url": { "type": "string" }
},
"additionalProperties": false
}
}
}

@ -152,6 +152,11 @@ class SitesInformation:
raise FileNotFoundError(f"Problem while attempting to access "
f"data file '{data_file_path}'."
)
try:
site_data.pop('$schema')
except:
pass
self.sites = {}

@ -5,10 +5,14 @@ import json
# Read the data.json file
with open("sherlock/resources/data.json", "r", encoding="utf-8") as data_file:
data = json.load(data_file)
data: dict = json.load(data_file)
# Removes schema-specific keywords for proper processing
social_networks: dict = dict(data)
social_networks.pop('$schema')
# Sort the social networks in alphanumeric order
social_networks = sorted(data.items())
social_networks: list = sorted(social_networks.items())
# Write the list of supported sites to sites.md
with open("sites.md", "w") as site_file:

Loading…
Cancel
Save