# Path: l2tscaffolder/lib/errors.py
# class Error(Exception):
# class EngineNotConfigured(Error):
# class FileHandlingError(Error):
# class NoValidDefinition(Error):
# class ScaffolderNotConfigured(Error):
# class UnableToConfigure(Error):
# class WrongCliInput(Error):
# 
# Path: l2tscaffolder/scaffolders/interface.py
# class BaseQuestion:
# class DictQuestion(BaseQuestion):
# class IntQuestion(BaseQuestion):
# class ListQuestion(BaseQuestion):
# class StringQuestion(BaseQuestion):
# class Scaffolder:
#   TYPE = None
#   TYPE = dict
#   TYPE = int
#   TYPE = list
#   TYPE = str
#   NAME = 'base_parser'
#   DESCRIPTION = ''
#   PROJECT = definitions.DEFINITION_PLASO
#   QUESTIONS = []
#   def __init__(self, attribute: str, prompt: str):
#   def _ValidateType(self, answer: object):
#   def ValidateAnswer(self, answer: object):
#   def __init__(self, attribute, prompt, key_prompt, value_prompt):
#   def __init__(self):
#   def GetInitFileChanges(self) -> Iterator[Tuple[str, str]]:
#   def GetJinjaContext(self) -> Dict[str, object]:
#   def GetQuestions(self) -> List[BaseQuestion]:
#   def GenerateFiles(self) -> Iterator[Tuple[str, str]]:
#   def GetFilesToCopy(self) -> Iterator[Tuple[str, str]]:
#   def RaiseIfNotReady(self):
#   def SetOutputName(self, output_name: str):
#   def SetAttribute(self, name: str, value: object, value_type: type):
# 
# Path: l2tscaffolder/scaffolders/plaso.py
# class TestFileQuestion(interface.StringQuestion):
# class PlasoBaseScaffolder(interface.Scaffolder):
# class PlasoPluginScaffolder(PlasoBaseScaffolder):
# class PlasoParserScaffolder(PlasoBaseScaffolder):
#   def ValidateAnswer(self, answer: str):
#   def __init__(self):
#   def _GenerateFormatter(self) -> str:
#   def _GenerateFormatterTest(self) -> str:
#   def _GenerateParser(self) -> str:
#   def _GenerateParserTest(self) -> str:
#   def GetInitFileChanges(self) -> Iterator[Tuple[str, str]]:
#   def GetJinjaContext(self) -> Dict[str, object]:
#   def GetQuestions(self) -> List[interface.BaseQuestion]:
#   def GenerateFiles(self) -> Iterator[Tuple[str, str]]:
#   def GetFilesToCopy(self) -> Iterator[Tuple[str, str]]:
#   def RaiseIfNotReady(self):
#   def __init__(self):
#   def GetJinjaContext(self) -> Dict[str, object]:
#   def __init__(self):
#   def GetJinjaContext(self) -> Dict[str, object]:
#   NAME = 'plaso_base'
#   DESCRIPTION = 'This is a scaffolder for plaso parsers and/or plugins'
#   PROJECT = definitions.DEFINITION_PLASO
#   TEMPLATE_PARSER_FILE = 'generic_plaso_parser.jinja2'
#   TEMPLATE_PARSER_TEST = 'generic_plaso_parser_test.jinja2'
#   TEMPLATE_FORMATTER_FILE = 'generic__plaso_formatter.jinja2'
#   TEMPLATE_FORMATTER_TEST = 'generic_plaso_formatter_test.jinja2'
#   QUESTIONS = []
# 
# Path: l2tscaffolder/scaffolders/manager.py
# class ScaffolderManager:
#   def DeregisterScaffolder(cls, scaffolder_class: Type[interface.Scaffolder]):
#   def GetScaffolderClasses(cls) -> Iterator[Type[interface.Scaffolder]]:
#   def GetScaffolderNames(cls) -> Iterator[str]:
#   def GetScaffolderInformation(cls) -> Iterator[Tuple[str, str]]:
#   def GetScaffolderObjectByName(
#       cls, scaffolder_name) -> Optional[interface.Scaffolder]:
#   def GetScaffolderObjects(cls) -> Dict[str, interface.Scaffolder]:
#   def GetScaffolderQuestions(cls) -> List[interface.BaseQuestion]:
#   def GetScaffolderQuestionByName(
#       cls, scaffolder_name: str) -> List[interface.BaseQuestion]:
#   def GetScaffolders(cls) -> Iterator[Tuple[str, Type[interface.Scaffolder]]]:
#   def RegisterScaffolder(cls, scaffolder_class: Type[interface.Scaffolder]):
#   def RegisterScaffolders(
#       cls, scaffolder_classes: List[Type[interface.Scaffolder]]):


import os
import sqlite3
from typing import Dict
from typing import Iterator
from typing import Tuple
from l2tscaffolder.lib import errors
from l2tscaffolder.scaffolders import interface
from l2tscaffolder.scaffolders import plaso
from l2tscaffolder.scaffolders import manager
  NAME = 'sqlite'
  DESCRIPTION = 'Provides a scaffolder to generate a plaso SQLite plugin.'

  SCHEMA_QUERY = (
      'SELECT tbl_name, sql '
      'FROM sqlite_master '
      'WHERE type = "table" AND tbl_name != "xp_proc" '
      'AND tbl_name != "sqlite_sequence"')

  # Filenames of templates.
  TEMPLATE_PARSER_FILE = 'sqlite_plugin.jinja2'
  TEMPLATE_PARSER_TEST = 'sqlite_plugin_test.jinja2'
  TEMPLATE_FORMATTER_FILE = 'sqlite_plugin_formatter.jinja2'
  TEMPLATE_FORMATTER_TEST = 'sqlite_plugin_formatter_test.jinja2'

  # Questions, a list that contains all the needed questions that the
  # user should be prompted about before the plugin or parser is created.
  # Each element in the list needs to be an instance of BaseQuestion.
  QUESTIONS = [
      SQLQuestion(
          attribute='queries', prompt=(
              'Define the name of the callback function (key) that will be\n'
              'called for every row returned from the SQL query (value).\n'
              'The plugin will execute the SQL query and call the callback\n'
              'once for each resulting row. The name of the function should\n'
              'follow style guide and be descriptive. An example of that is\n'
              'a SQL statement that fetches bookmarks, the key name should be\n'
              'Bookmark, or if the SQL statement collects GPS coordinates\n'
              'it could be called Location.'),
          key_prompt='Callback function name', value_prompt='SQL Statement'),

# Path: l2tscaffolder/lib/errors.py
# class Error(Exception):
# class EngineNotConfigured(Error):
# class FileHandlingError(Error):
# class NoValidDefinition(Error):
# class ScaffolderNotConfigured(Error):
# class UnableToConfigure(Error):
# class WrongCliInput(Error):
# 
# Path: l2tscaffolder/scaffolders/interface.py
# class BaseQuestion:
# class DictQuestion(BaseQuestion):
# class IntQuestion(BaseQuestion):
# class ListQuestion(BaseQuestion):
# class StringQuestion(BaseQuestion):
# class Scaffolder:
#   TYPE = None
#   TYPE = dict
#   TYPE = int
#   TYPE = list
#   TYPE = str
#   NAME = 'base_parser'
#   DESCRIPTION = ''
#   PROJECT = definitions.DEFINITION_PLASO
#   QUESTIONS = []
#   def __init__(self, attribute: str, prompt: str):
#   def _ValidateType(self, answer: object):
#   def ValidateAnswer(self, answer: object):
#   def __init__(self, attribute, prompt, key_prompt, value_prompt):
#   def __init__(self):
#   def GetInitFileChanges(self) -> Iterator[Tuple[str, str]]:
#   def GetJinjaContext(self) -> Dict[str, object]:
#   def GetQuestions(self) -> List[BaseQuestion]:
#   def GenerateFiles(self) -> Iterator[Tuple[str, str]]:
#   def GetFilesToCopy(self) -> Iterator[Tuple[str, str]]:
#   def RaiseIfNotReady(self):
#   def SetOutputName(self, output_name: str):
#   def SetAttribute(self, name: str, value: object, value_type: type):
# 
# Path: l2tscaffolder/scaffolders/plaso.py
# class TestFileQuestion(interface.StringQuestion):
# class PlasoBaseScaffolder(interface.Scaffolder):
# class PlasoPluginScaffolder(PlasoBaseScaffolder):
# class PlasoParserScaffolder(PlasoBaseScaffolder):
#   def ValidateAnswer(self, answer: str):
#   def __init__(self):
#   def _GenerateFormatter(self) -> str:
#   def _GenerateFormatterTest(self) -> str:
#   def _GenerateParser(self) -> str:
#   def _GenerateParserTest(self) -> str:
#   def GetInitFileChanges(self) -> Iterator[Tuple[str, str]]:
#   def GetJinjaContext(self) -> Dict[str, object]:
#   def GetQuestions(self) -> List[interface.BaseQuestion]:
#   def GenerateFiles(self) -> Iterator[Tuple[str, str]]:
#   def GetFilesToCopy(self) -> Iterator[Tuple[str, str]]:
#   def RaiseIfNotReady(self):
#   def __init__(self):
#   def GetJinjaContext(self) -> Dict[str, object]:
#   def __init__(self):
#   def GetJinjaContext(self) -> Dict[str, object]:
#   NAME = 'plaso_base'
#   DESCRIPTION = 'This is a scaffolder for plaso parsers and/or plugins'
#   PROJECT = definitions.DEFINITION_PLASO
#   TEMPLATE_PARSER_FILE = 'generic_plaso_parser.jinja2'
#   TEMPLATE_PARSER_TEST = 'generic_plaso_parser_test.jinja2'
#   TEMPLATE_FORMATTER_FILE = 'generic__plaso_formatter.jinja2'
#   TEMPLATE_FORMATTER_TEST = 'generic_plaso_formatter_test.jinja2'
#   QUESTIONS = []
# 
# Path: l2tscaffolder/scaffolders/manager.py
# class ScaffolderManager:
#   def DeregisterScaffolder(cls, scaffolder_class: Type[interface.Scaffolder]):
#   def GetScaffolderClasses(cls) -> Iterator[Type[interface.Scaffolder]]:
#   def GetScaffolderNames(cls) -> Iterator[str]:
#   def GetScaffolderInformation(cls) -> Iterator[Tuple[str, str]]:
#   def GetScaffolderObjectByName(
#       cls, scaffolder_name) -> Optional[interface.Scaffolder]:
#   def GetScaffolderObjects(cls) -> Dict[str, interface.Scaffolder]:
#   def GetScaffolderQuestions(cls) -> List[interface.BaseQuestion]:
#   def GetScaffolderQuestionByName(
#       cls, scaffolder_name: str) -> List[interface.BaseQuestion]:
#   def GetScaffolders(cls) -> Iterator[Tuple[str, Type[interface.Scaffolder]]]:
#   def RegisterScaffolder(cls, scaffolder_class: Type[interface.Scaffolder]):
#   def RegisterScaffolders(
#       cls, scaffolder_classes: List[Type[interface.Scaffolder]]):


# Path: l2tscaffolder/scaffolders/plaso_sqlite.py
import os
import sqlite3
from typing import Dict
from typing import Iterator
from typing import Tuple
from l2tscaffolder.lib import errors
from l2tscaffolder.scaffolders import interface
from l2tscaffolder.scaffolders import plaso
from l2tscaffolder.scaffolders import manager

  NAME = 'sqlite'
  DESCRIPTION = 'Provides a scaffolder to generate a plaso SQLite plugin.'

  SCHEMA_QUERY = (
      'SELECT tbl_name, sql '
      'FROM sqlite_master '
      'WHERE type = "table" AND tbl_name != "xp_proc" '
      'AND tbl_name != "sqlite_sequence"')

  # Filenames of templates.
  TEMPLATE_PARSER_FILE = 'sqlite_plugin.jinja2'
  TEMPLATE_PARSER_TEST = 'sqlite_plugin_test.jinja2'
  TEMPLATE_FORMATTER_FILE = 'sqlite_plugin_formatter.jinja2'
  TEMPLATE_FORMATTER_TEST = 'sqlite_plugin_formatter_test.jinja2'

  # Questions, a list that contains all the needed questions that the
  # user should be prompted about before the plugin or parser is created.
  # Each element in the list needs to be an instance of BaseQuestion.
  QUESTIONS = [
      SQLQuestion(
          attribute='queries', prompt=(
              'Define the name of the callback function (key) that will be\n'
              'called for every row returned from the SQL query (value).\n'
              'The plugin will execute the SQL query and call the callback\n'
              'once for each resulting row. The name of the function should\n'
              'follow style guide and be descriptive. An example of that is\n'
              'a SQL statement that fetches bookmarks, the key name should be\n'
              'Bookmark, or if the SQL statement collects GPS coordinates\n'
              'it could be called Location.'),
          key_prompt='Callback function name', value_prompt='SQL Statement'),

      interface.ListQuestion(