mirror of
https://github.com/sherlock-project/sherlock
synced 2024-11-26 13:50:22 +00:00
Add basic schema
This commit is contained in:
parent
58a2cc9c43
commit
198798d28b
4 changed files with 75 additions and 9 deletions
|
@ -1,4 +1,5 @@
|
||||||
{
|
{
|
||||||
|
"$schema": "data.schema.json",
|
||||||
"1337x": {
|
"1337x": {
|
||||||
"errorMsg": [
|
"errorMsg": [
|
||||||
"<title>Error something went wrong.</title>",
|
"<title>Error something went wrong.</title>",
|
||||||
|
@ -479,8 +480,7 @@
|
||||||
"url": "https://codeforces.com/profile/{}",
|
"url": "https://codeforces.com/profile/{}",
|
||||||
"urlMain": "https://codeforces.com/",
|
"urlMain": "https://codeforces.com/",
|
||||||
"urlProbe": "https://codeforces.com/api/user.info?handles={}",
|
"urlProbe": "https://codeforces.com/api/user.info?handles={}",
|
||||||
"username_claimed": "tourist",
|
"username_claimed": "tourist"
|
||||||
"username_unclaimed": "noonewouldeverusethis7"
|
|
||||||
},
|
},
|
||||||
"Codepen": {
|
"Codepen": {
|
||||||
"errorType": "status_code",
|
"errorType": "status_code",
|
||||||
|
@ -1072,8 +1072,7 @@
|
||||||
"errorUrl": "https://irc-galleria.net/users/search?username={}",
|
"errorUrl": "https://irc-galleria.net/users/search?username={}",
|
||||||
"url": "https://irc-galleria.net/user/{}",
|
"url": "https://irc-galleria.net/user/{}",
|
||||||
"urlMain": "https://irc-galleria.net/",
|
"urlMain": "https://irc-galleria.net/",
|
||||||
"username_claimed": "appas",
|
"username_claimed": "appas"
|
||||||
"username_unclaimed": "noonewouldeverusethis77"
|
|
||||||
},
|
},
|
||||||
"Icons8 Community": {
|
"Icons8 Community": {
|
||||||
"errorType": "status_code",
|
"errorType": "status_code",
|
||||||
|
@ -1160,7 +1159,6 @@
|
||||||
},
|
},
|
||||||
"Jimdo": {
|
"Jimdo": {
|
||||||
"errorType": "status_code",
|
"errorType": "status_code",
|
||||||
"noPeriod": "True",
|
|
||||||
"regexCheck": "^[a-zA-Z0-9@_-]$",
|
"regexCheck": "^[a-zA-Z0-9@_-]$",
|
||||||
"url": "https://{}.jimdosite.com",
|
"url": "https://{}.jimdosite.com",
|
||||||
"urlMain": "https://jimdosite.com/",
|
"urlMain": "https://jimdosite.com/",
|
||||||
|
@ -1334,8 +1332,7 @@
|
||||||
"url": "https://monkeytype.com/profile/{}",
|
"url": "https://monkeytype.com/profile/{}",
|
||||||
"urlMain": "https://monkeytype.com/",
|
"urlMain": "https://monkeytype.com/",
|
||||||
"urlProbe": "https://api.monkeytype.com/users/{}/profile",
|
"urlProbe": "https://api.monkeytype.com/users/{}/profile",
|
||||||
"username_claimed": "Lost_Arrow",
|
"username_claimed": "Lost_Arrow"
|
||||||
"username_unclaimed": "noonewouldeverusethis7"
|
|
||||||
},
|
},
|
||||||
"Motherless": {
|
"Motherless": {
|
||||||
"errorMsg": "no longer a member",
|
"errorMsg": "no longer a member",
|
||||||
|
|
60
sherlock/resources/data.schema.json
Normal file
60
sherlock/resources/data.schema.json
Normal file
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -153,6 +153,11 @@ class SitesInformation:
|
||||||
f"data file '{data_file_path}'."
|
f"data file '{data_file_path}'."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
|
site_data.pop('$schema')
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
self.sites = {}
|
self.sites = {}
|
||||||
|
|
||||||
# Add all site information from the json file to internal site list.
|
# Add all site information from the json file to internal site list.
|
||||||
|
|
|
@ -5,10 +5,14 @@ import json
|
||||||
|
|
||||||
# Read the data.json file
|
# Read the data.json file
|
||||||
with open("sherlock/resources/data.json", "r", encoding="utf-8") as data_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
|
# 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
|
# Write the list of supported sites to sites.md
|
||||||
with open("sites.md", "w") as site_file:
|
with open("sites.md", "w") as site_file:
|
||||||
|
|
Loading…
Reference in a new issue