Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
from abc import abstractmethod
from typing import Optional, Dict, Any, Set, Generic, Type
from functools import lru_cache
import ciphey
from ciphey.iface import T, ParamSpec, Config, get_args, registry
import json
import csv
# We can use a generic resource loader here, as we can instantiate it later
@registry.register_multi(ciphey.iface.WordList, ciphey.iface.Distribution)
class Json(ciphey.iface.ResourceLoader):
def whatResources(self) -> T:
return self._names
@lru_cache
def getResource(self, name: str) -> T:
prefix, name = name.split("::", 1)
return {"wordlist": (lambda js: {js}), "dist": (lambda js: js)}[prefix](
json.load(open(self._paths[int(name) - 1]))
)
@staticmethod
def getName() -> str:
return "json"
@staticmethod
from typing import Optional, Dict, List
from ciphey.iface import ParamSpec, Config, T, U, Decoder, registry
@registry.register_multi((str, str), (bytes, bytes))
class Reverse(Decoder):
def decode(self, ctext: T) -> Optional[U]:
return ctext[::-1]
@staticmethod
def priority() -> float:
return 0.05
def __init__(self, config: Config):
super().__init__(config)
@staticmethod
def getParams() -> Optional[Dict[str, ParamSpec]]:
pass
@staticmethod