示例#1
0
文件: main.py 项目: 9-volt/captchonka
  def run(self):
    options = self.options

    # List mods
    if options.listmods:
      Logger.header("List of mods", True)

      mods_dir = "core/mods/"

      for dir in os.listdir(mods_dir):
        if os.path.isdir(os.path.join(mods_dir, dir)):
          Logger.log(dir, True)

      sys.exit(2)

    # Train
    if options.train:
      captcha = options.train
      self.train(captcha)

    # Crack
    if options.crack:
      captcha = options.crack
      self.crack(captcha)

    # Batch train with percentage
    if options.batch_train:
      self.batch_train(options.batch_train)

    # Batch crack with percentage
    if options.batch_crack:
      self.batch_crack(options.batch_crack)
示例#2
0
文件: main.py 项目: 9-volt/captchonka
  def create_options(self, args=None):
    self.options = CaptchonkaOptions().get_options(args)

    Logger.header('Options')
    for key, value in self.options.__dict__.items():
      Logger.log('  ' + key + ': ' + str(value))

    project_folder = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
    self.options.output_dir = os.path.join(project_folder, 'output')

    if self.options.mod:
      self.options.mod_dir = os.path.join(project_folder, 'core', 'mods', self.options.mod)