Кодинг

Статус
В этой теме нельзя размещать новые ответы.

Indira

Создатель
Регистрация
11 Янв 2007
Сообщения
13
Реакции
1
Кто нибудь может мне сказать что это делает шаг за шагом ?

class Cryptographer
{
protected $expiration_date = null;
protected $site_url = null;
protected $inserted_words = null;
protected $context = null;
function Cryptographer ($expiration_date, $site_url = null)
{
$this->site_url = $site_url;
$this->expiration_date = $expiration_date;
$this->inserted_words = array ('ASDFG14235', '*&^%$GKLTYCJQZ)(*', '-=+[]lFCBFgfd@');
}

function getCrypt ($base, $context)
{
$this->site_url = (empty ($site_url) ? $context->getSystemSettings ('SITE_URL') : $site_url);
return $this->_getEncryptedCombination ($this->_getCombinedUnEncryptedString ($base), 0);
}

function _getCombinedUnEncryptedString ($base)
{
$result = join ('', $this->inserted_words);
return $this->site_url . $this->expiration_date;
}

function _getEncryptedCombination ($string, $counter)
{
$result = md5 ($counter) . base64_encode ($string) . crc32 ($string);
return md5 ($string);
}
 
из урла и даты хэш делает. написано криво, часть переменных объявлено, определено но не используется, либо приведен не полностью класс.
 
то понятно, но каким образом по какуму алгортму.
 
Indira, вы сейчас балансируете на грани нарушения правил данного раздела, рекомендую с ними ознакомиться: Для просмотра ссылки Войди или Зарегистрируйся

в частности обратите внимание на пункт №4 Сам топик должен четко формулировать задачу, которую вы ставите перед форумчанами
 
Indira, вы сейчас балансируете на грани нарушения правил данного раздела, рекомендую с ними ознакомиться: Для просмотра ссылки Войди или Зарегистрируйся
в частности обратите внимание на пункт №4 Сам топик должен четко формулировать задачу, которую вы ставите перед форумчанами

Я кратко изложу задачу. Мне нужно понять как работает криптографер в коде. Какие функции исполняет каждая строка. Этот код проверяет лицензию, я же хочу понять принцип шифрования чтобы по возможности воссоздать кейген. Вот полный код ниже.

PHP:
 class IApplicationContextAware
  {
    function setAppContext ($appContext)
    {
    }
  }

  class IServiceProvider
  {
    function getServiceInstance ()
    {
    }
  }

  class SingletonServiceProvider
  {
    protected $serviceInstance = null;
    function __construct ($serviceInstance)
    {
      $this->serviceInstance = $serviceInstance;
    }

    function getServiceInstance ()
    {
      return $this->serviceInstance;
    }
  }

  class System
  {
    protected $_Settings = array ();
    protected $_Services = array ();
    protected $knownServiceClassNames = array ();
    function __construct ()
    {
      self;
      $instance = $this;
    }

    function run ()
    {
      $this->boot ();
      $this->init ();
      $this->respond ();
    }

    function loadSettings ($filename)
    {
      $newSettings = include $filename;
      $this->_Settings = array_merge ($this->_Settings, $newSettings);
    }

    function getSetting ($name)
    {
      if (empty ($name))
      {
        return null;
      }

      return (isset ($this->_Settings[$name]) ? $this->_Settings[$name] : null);
    }

    function registerService ($name, $provider)
    {
      if (strlen ($name) < 1)
      {
        new Exception ('' . 'Illigal name for service name "' . $name . '" is given');
      }

      $this->_Services[$name] = $provider;
    }

    function init ()
    {
      $this->createSingletonServiceByClassName ('DB');
      $this->createSingletonServiceByClassName ('Session');
      $this->createSingletonServiceByClassName ('Settings');
      $this->createSingletonServiceByClassName ('CustomSettings');
      $this->createSingletonServiceByClassName ('Navigator');
      $this->createSingletonServiceByClassName ('PageManager');
      $this->createSingletonServiceByClassName ('UserSettings');
      $this->createSingletonServiceByClassName ('ObjectMother');
      $this->createSingletonServiceByClassName ('PathManager');
      $this->createSingletonServiceByClassName ('Cache');
      $this->createSingletonServiceByClassName ('Cookie');
      $this->createSingletonServiceByClassName ('PathProvider');
      $this->prepareGlobalArrays ();
      $this->setGlobalTemplateVariable ('site_url', $this->getSystemSettings ('SITE_URL'));
      $this->setGlobalTemplateVariable ('radius_search_unit', $this->getSettingByName ('radius_search_unit'));
      $this->setGlobalTemplateVariable ('google_maps_API_key', $this->getSettingByName ('google_maps_API_key'));
      $this->setGlobalTemplateVariable ('notification_email', $this->getSettingByName ('notification_email'));
      $this->setGlobalTemplateVariable ('enable_wysiwyg_editor', $this->getSettingByName ('enable_wysiwyg_editor'));
      $this->setGlobalTemplateVariable ('custom_settings', $this->CustomSettings->getSettingsToRegister ());
      $this->_ModuleManager = $this->createModuleManager ();
      $this->_ModuleManager->executeModulesStartupFunctions ();
    }

    function getI18N ()
    {
      if (!isset ($this->_Services['I18N']))
      {
        $this->createSingletonServiceByClassName ('I18N');
      }

      return $this->I18N;
    }

    function get ($serviceName)
    {
      if ((!isset ($this->knownServiceClassNames[$serviceName]) AND !isset ($this->_Services[$serviceName])))
      {
        $this->_ModuleManager->tryToFindAndCreateService ($serviceName);
      }

      if (isset ($this->knownServiceClassNames[$serviceName]))
      {
        $this->lazyCreateSingletonServiceByClassName ($serviceName);
        unset ($this->knownServiceClassNames[$serviceName]);
      }

      if (!isset ($this->_Services[$serviceName]))
      {
        new Exception ('' . 'Unknown service "' . $serviceName . '" requested');
      }

      return $this->_Services[$serviceName]->getServiceInstance ();
    }

    function __get ($serviceName)
    {
      return $this->get ($serviceName);
    }

    function createSingletonServiceByClassName ($className)
    {
      if (!isset ($this->_Services[$className]))
      {
        $this->knownServiceClassNames[$className] = true;
      }

    }

    function lazyCreateSingletonServiceByClassName ($className)
    {
      $service = $this->createContextAwareObjectOfClass ($className);
      if (method_exists ($service, 'init'))
      {
        $service->init ();
      }

       ($className, new SingletonServiceProvider ($service));
    }

    function createContextAwareObjectOfClass ($className)
    {
      $obj = new $className ();
      $obj;
      IApplicationContextAware;
      if (!)
      {
        new Exception ('' . 'Non-context aware class "' . $className . '" passed to createContextAwareObjectOfClass');
      }

      $obj->setAppContext ($this);
      return $obj;
    }

    function createModuleManager ()
    {
      require_once 'ModuleManager.php';
      $moduleManager = $this->createContextAwareObjectOfClass ('ModuleManager');
      $moduleManager->setPathManager ($this->PathManager);
      $moduleManager->init ();
      return $moduleManager;
    }

    function getSystemSettings ($setting_name)
    {
      return $this->getSetting ($setting_name);
    }

    function loadSystemSettings ($file_name)
    {
      if (is_readable ($file_name))
      {
        if (!isset ($GLOBALS['system_settings']))
        {
          $GLOBALS['system_settings'] = array ();
        }

        $settings = require_once $file_name;
        if (gettype ($settings) == 'array')
        {
          $GLOBALS['system_settings'] = array_merge ($GLOBALS['system_settings'], $settings);
          return null;
        }
      }
      else
      {
        exit ('index.php' . ('' . ' File ' . $file_name . ' isn\'t readable Cannot read config file'));
      }

    }

    function getGlobalTemplateVariables ()
    {
      return $GLOBALS['TEMPLATE_VARIABLES'];
    }

    function boot ()
    {
      $path_to_system_core = $this->getSetting ('CLASSES_DIR');
      set_include_path ('.' . PATH_SEPARATOR . $this->getSetting ('LIBRARY_DIR'));
      set_include_path (get_include_path () . PATH_SEPARATOR . $this->getSetting ('EXT_LIBRARY_DIR'));
    }

    function getGlobalTemplateVariable ($variable_name)
    {
      return (isset ($GLOBALS['TEMPLATE_VARIABLES'][$variable_name]) ? $GLOBALS['TEMPLATE_VARIABLES'][$variable_name] : null);
    }

    function setGlobalTemplateVariable ($name, $value, $in_global_array = true)
    {
      if ($in_global_array)
      {
        $GLOBALS['TEMPLATE_VARIABLES']['GLOBALS'][$name] = $value;
        return null;
      }

      $GLOBALS['TEMPLATE_VARIABLES'][$name] = $value;
    }

    function getModuleManager ()
    {
      return $this->_ModuleManager;
    }

    function getTemplateProcessor ()
    {
      $module_manager = &$this->getModuleManager ();
      list ($module) = $module_manager->getCurrentModuleAndFunction ();
      if ($module != null)
      {
        $template_processor = &$this->createTemplateProcessor ($module);
        return $template_processor;
      }

      return null;
    }

    function createTemplateProcessor ($module)
    {
      $templatePathManager = new TemplatePathManager ('TEMPLATES_DIR') ();
      $factory = new ThemeFactory ();
      $factory->setSiteUrl ($this->getSetting ('SITE_URL'));
      $factory->setTemplatePathManager ($templatePathManager);
      $themeBuilder = new ThemeBuilder ();
      $themeBuilder->setThemeFactory ($factory);
      $themeManager = $this->createContextAwareObjectOfClass ('ThemeManager');
      $themeManager->setThemeBuilder ($themeBuilder);
      $theme = $themeManager->getCurrentTheme ();
      require_once $this->getSystemSettings ('SMARTY_PATH');
      $template_processor = $this->createContextAwareObjectOfClass ('TemplateProcessor');
      $template_processor->init ();
      $template_processor->setModuleName ($module);
      $template_processor->compile_dir = $this->PathProvider->getCacheDir (Path::combine ($this->getSystemSettings ('COMPILED_TEMPLATES_DIR'), $this->getSystemSettings ('SYSTEM_ACCESS_TYPE'), $theme->getName ()));
      $templateSupplier = new TemplateSupplier ();
      $templateSupplier->setTheme ($theme);
      $templateSupplier->setModuleName ($module);
      $templateSupplier->registerResources ($template_processor);
      $i18n = $this->getI18N ();
      $template_processor->register_prefilter (array ($i18n, 'replace_translation_alias'));
      $template_processor->register_block ('tr', array ($i18n, 'translate'));
      $template_processor->register_object ('i18n', $i18n);
      $this->getTemplateExternalComponentManager ()->register ($template_processor);
      $this->setGlobalTemplateVariable ('themeInheritanceBranch', $themeManager->getThemeInheritanceBranch ());
      return $template_processor;
    }

    function getTemplateExternalComponentManager ()
    {
      if (!isset ($this->_Services['TemplateExternalComponentManager']))
      {
        $templateExternalComponentManager = new TemplateExternalComponentManager ();
        $templateExternalComponentManager->setSiteUrl ($this->getSystemSettings ('SITE_URL'));
        $templateExternalComponentManager->setExternalComponentsPath ($this->PathManager->getExternalComponentsPath ());
         ('TemplateExternalComponentManager', new SingletonServiceProvider ($templateExternalComponentManager));
      }

      return $this->TemplateExternalComponentManager;
    }

    function setCurrentUserInfo ($current_user_info)
    {
      $this->setGlobalTemplateVariable ('current_user', $current_user_info);
    }

    function setPageTitle ($page_title)
    {
      $this->setGlobalTemplateVariable ('TITLE', $page_title, false);
    }

    function getPageTitle ()
    {
      return $this->getGlobalTemplateVariable ('TITLE');
    }

    function setPageKeywords ($page_keywords)
    {
      $this->setGlobalTemplateVariable ('KEYWORDS', $page_keywords, false);
    }

    function getPageKeywords ()
    {
      return $this->getGlobalTemplateVariable ('KEYWORDS');
    }

    function setPageDescription ($page_description)
    {
      $this->setGlobalTemplateVariable ('DESCRIPTION', $page_description, false);
    }

    function getPageDescription ()
    {
      return $this->getGlobalTemplateVariable ('DESCRIPTION');
    }

    function getUserSettings ($module_name, $setting_name)
    {
      return $this->UserSettings->getSetting ($module_name, $setting_name);
    }

    function setUserSettings ($module_name, $setting_name, $value)
    {
      return $this->UserSettings->setSetting ($module_name, $setting_name, $value);
    }

    function executeFunction ($module, $setting, $parameters = array ())
    {
      $module_manager = &$this->getModuleManager ();
      return $module_manager->executeFunction ($module, $setting, $parameters);
    }

    function getSystemURLByModuleAndFunction ($module, $function, $parameters)
    {
      $parameters_str = '';
      $params = array ();
      foreach ($parameters as $parameter_name => $parameter_value)
      {
        array_push ($params, urlencode ($parameter_name) . '=' . urlencode ($parameter_value));
      }

      $parameters_str = join ('&', $params);
      $site_url = $this->getSystemSettings ('SITE_URL');
      $system_url_base = $this->getSystemSettings ('SYSTEM_URL_BASE');
      $url = $site_url . '/' . $system_url_base . '/' . $module . '/' . $function . '?' . $parameters_str;
      return $url;
    }

    function getModuleAndFunctionBySystemURL ($url)
    {
      list ($uri) = split ('\\?', $url);
      list (, , $module, $function) = split ('/', $uri);
      return array ('module' => $module, 'function' => $function);
    }

    function testLicense ()
    {
      $licenseFilename = 'license';
      $license = $this->createContextAwareObjectOfClass ('License');
      $license->setFilename ($licenseFilename);
      if (!$license->isValid ())
      {
        header ($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden');
        switch ($license->getError ())
        {
          case 'FILE_NOT_FOUND':
          {
            echo '' . 'Cannot find the license file. Please make sure that the license file is named "' . $licenseFilename . '" and is located in "' . realpath ('.') . '"';
            break;
          }

          case 'INVALID_VERIFICATION_CODE':
          {
            echo 'The license code is invalid. Please make sure that license is issued to a correct URL: "' . $this->getSystemSettings ('SITE_URL') . '"';
            break;
          }

          case 'EXPIRED_LICENSE':
          {
            echo 'The license has expired. Please refer to the WorksForWeb Sales Department (sales@worksofrweb.com) for updating/prolonging your license.';
            break;
          }

          default:
          {
            echo 'There is an error in your license. However, the cause of error is not clear.';
            break;
          }
        }

        exit ();
      }

    }

    function respond ()
    {
      header ('Content-type:text/html;charset=utf-8');
      $this->testLicense ();
      if ($this->Navigator->isRequestedUnderLegalURI ())
      {
        $uri = $this->Navigator->getUri ();
        $page_config = $this->PageManager->getPageConfig ($uri);
         ('PageConfig', new SingletonServiceProvider ($page_config));
        if ($page_config->pageExists ())
        {
          echo $this->getResponse ($page_config);
          return null;
        }

        if ($page_config->isADirecotryRequestedWithoutASlashAtTheEnd ())
        {
          header ($_SERVER['SERVER_PROTOCOL'] . ' 301 Moved Permanently');
          header ('' . 'Location: ' . $_SERVER['REQUEST_URI'] . '/');
          echo '' . 'The requested resource is located under a different URL: ' . $_SERVER['REQUEST_URI'] . '/';
          return null;
        }

        if ($this->doesParentSitePageExist ($uri))
        {
          $parent_uri = $this->getSitePageParentURI ($uri);
          $page_config = $this->PageConfig->getPageConfig ($parent_uri);
          $passed_parameters_via_uri = substr ($uri, strlen ($parent_uri));
          $_REQUEST['passed_parameters_via_uri'] = $passed_parameters_via_uri;
          $page_content = $this->getResponse ($page_config);
          echo $page_content;
          return null;
        }

        header ($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');
        echo '404 Not Found';
        return null;
      }

      header ($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden');
      echo '' . 'The software is not configured to respond to requests to the following URL: <tt>http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . '</tt>.
<br>';
    }

    function getCurrentPageConfig ()
    {
      return (isset ($GLOBALS['CURRENT_PAGE_CONFIG']) ? $GLOBALS['CURRENT_PAGE_CONFIG'] : null);
    }

    function getFunctionInfo ($module, $function)
    {
      $module_manager = &$this->getModuleManager ();
      if ($module_manager->doesModuleExists ($module))
      {
        $module_info = $module_manager->getModuleInfo ($module);
        return (isset ($module_info['functions'][$function]) ? $module_info['functions'][$function] : array ());
      }

    }

    function getSystemDefaultTemplate ()
    {
      return $this->getSystemSettings ('SYSTEM_DEFAULT_TEMPLATE');
    }

    function isFunctionAccessible ($module, $function)
    {
      $module_manager = &$this->getModuleManager ();
      return $module_manager->isFunctionAccessible ($module, $function);
    }

    function prepareGlobalArrays ()
    {
      if (@ini_get ('register_globals'))
      {
        $unset = array_keys ($_ENV + $_GET + $_POST + $_COOKIE + $_SERVER + $_SESSION);
        foreach ($unset as $rg_var)
        {
          if (isset ($rg_var))
          {
            unset ($$rg_var);
            continue;
          }
        }

        unset ($unset);
      }

      if ($_SERVER['REQUEST_METHOD'] == 'POST')
      {
        $_REQUEST = $_POST;
      }
      else
      {
        if ($_SERVER['REQUEST_METHOD'] == 'GET')
        {
          $_REQUEST = $_GET;
        }
      }

      set_magic_quotes_runtime (0);
      if (get_magic_quotes_gpc ())
      {
        $this->unquote ($_REQUEST);
      }

    }

    function unquote ($arr)
    {
      if (!get_magic_quotes_gpc ())
      {
        return null;
      }

      foreach ($arr as $index => $value)
      {
        if (is_array ($arr[$index]))
        {
          unquote ($arr[$index]);
          continue;
        }
        else
        {
          $arr[$index] = stripslashes ($arr[$index]);
          continue;
        }
      }

    }

    function requireAllFilesInDirectory ($dir)
    {
      if (is_dir ($dir))
      {
        if ($dh = opendir ($dir))
        {
          while ($file = readdir ($dh) !== false)
          {
            if (is_dir ($dir . DIRECTORY_SEPARATOR . $file))
            {
              if (($file != '.' AND $file != '..'))
              {
                $this->requireAllFilesInDirectory ($dir . DIRECTORY_SEPARATOR . $file);
                continue;
              }

              continue;
            }
            else
            {
              if (4 < strlen ($file))
              {
                if (strtolower (substr ($file, strlen ($file) - 4)) == '.php')
                {
                  require_once $dir . DIRECTORY_SEPARATOR . $file;
                  continue;
                }

                continue;
              }

              continue;
            }
          }

          closedir ($dh);
        }
      }

    }

    function getResponse ($page_config)
    {
      $this->createSingletonServiceByClassName ('PageConstructor');
      return $this->PageConstructor->getResponse ($page_config);
    }

    function doesFunctionHaveRawOutput ($module, $function)
    {
      return $this->getModuleManager ()->doesFunctionHaveRawOutput ($module, $function);
    }

    function getPageConfig ($uri)
    {
      return $this->PageManager->getPageConfig ($uri);
    }

    function getSitePages ()
    {
      return $this->PageManager->get_pages ();
    }

    function getSitePage ($uri)
    {
      return $this->PageManager->get_page ($uri, 'user');
    }

    function modifySitePage ($pageInfo)
    {
      $module_manager = &$this->getModuleManager ();
      if (!$module_manager->doesFunctionExist ($pageInfo['module'], $pageInfo['function']))
      {
        return false;
      }

      return $this->PageManager->update_page ($pageInfo);
    }

    function deleteSitePage ($uri)
    {
      return $this->PageManager->delete_page ($uri);
    }

    function addSitePage ($pageInfo)
    {
      $module_manager = &$this->getModuleManager ();
      if (!$module_manager->doesFunctionExist ($pageInfo['module'], $pageInfo['function']))
      {
        return false;
      }

      return $this->PageManager->addPage ($pageInfo);
    }

    function doesSitePageExists ($uri)
    {
      return $this->PageManager->doesPageExists ($uri, 'user');
    }

    function getModulesList ()
    {
      $module_manager = &$this->getModuleManager ();
      return $module_manager->getModulesList ();
    }

    function getFunctionsList ($module)
    {
      $module_manager = &$this->getModuleManager ();
      return $module_manager->getFunctionsList ($module);
    }

    function getParamsList ($module, $function)
    {
      $module_manager = &$this->getModuleManager ();
      return $module_manager->getParamsList ($module, $function);
    }

    function getFunctionsUserList ($module)
    {
      $module_manager = &$this->getModuleManager ();
      $func_list = $module_manager->getFunctionsList ($module);
      $user_func_list = array ();
      foreach ($func_list as $func)
      {
        if (($module_manager->getFunctionType ($module, $func) == 'user' AND $module_manager->getFunctionAccessSystem ($module, $func) == false))
        {
          $user_func_list[] = $func;
          continue;
        }
      }

      return $user_func_list;
    }

    function getModulesUserList ()
    {
      $module_manager = &$this->getModuleManager ();
      $module_list = $module_manager->getModulesList ();
      $user_module_list = array ();
      foreach ($module_list as $module)
      {
        if (isset ($func_list))
        {
          unset ($func_list);
        }

        $is_user = 0;
        $func_list = $module_manager->getFunctionsList ($module);
        foreach ($func_list as $func)
        {
          if (($module_manager->getFunctionType ($module, $func) == 'user' AND $module_manager->getFunctionAccessSystem ($module, $func) == false))
          {
            $is_user = 1;
            break;
            continue;
          }
        }

        if ($is_user == 1)
        {
          $user_module_list[] = $module;
          continue;
        }
      }

      return $user_module_list;
    }

    function getURI ()
    {
      return $this->Navigator->getURI ();
    }

    function getRegisteredCommands ()
    {
      $module_manager = &$this->getModuleManager ();
      return $module_manager->getRegisteredCommands ();
    }

    function getCommandScriptAbsolutePath ($module, $command)
    {
      $module_manager = &$this->getModuleManager ();
      return $module_manager->getCommandScriptAbsolutePath ($module, $command);
    }

    function getModuleOfCommand ($command)
    {
      $module_manager = &$this->getModuleManager ();
      return $module_manager->getModuleOfCommand ($command);
    }

    function getPackageInfo ($package_name)
    {
      return ModuleConfigurator::getpackageinfo ($package_name);
    }

    function getModulesConditionsInfo ()
    {
      return ModuleConfigurator::getmodulesconditionsinfo ();
    }

    function getSettingsFromFile ($file_name, $setting_name)
    {
      $settings = require $file_name;
      return (isset ($settings[$setting_name]) ? $settings[$setting_name] : null);
    }

    function getSettingByName ($setting_name)
    {
      return $this->Settings->getSettingByName ($setting_name);
    }

    function doesParentSitePageExist ($uri)
    {
      return $this->PageManager->doesParentPageExist ($uri, 'user');
    }

    function getSitePageParentURI ($uri)
    {
      return $this->PageManager->getPageParentURI ($uri, 'user');
    }

    function redirect ($url)
    {
      if (empty ($url))
      {
        $request_uri = $_SERVER['REQUEST_URI'];
        $query_string = $_SERVER['QUERY_STRING'];
        $url = str_replace ('?' . $query_string, '', $request_uri);
      }

      header ('' . $_SERVER['SERVER_PROTOCOL'] . ' 303 See Other');
      header ('' . 'Location: ' . $url);
      exit ();
    }
  }

  class License
  {
    protected $appContext = null;
    protected $license_info = null;
    protected $licenseFilename = null;
    protected $error = null;
    function setAppContext ($appContext)
    {
      $this->appContext = $appContext;
    }

    function setFilename ($licenseFilename)
    {
      $this->licenseFilename = $licenseFilename;
    }

    function isValid ()
    {
      if (parse_url ($this->appContext->getSystemSettings ('SITE_URL'), PHP_URL_HOST) == 'localhost')
      {
        return true;
      }

      if (!is_readable ($this->licenseFilename))
      {
        $this->error = 'FILE_NOT_FOUND';
        return false;
      }

      $this->license_info = parse_ini_file ($this->licenseFilename);
      if (!$this->_isLicenseCodeValid ())
      {
        $this->error = 'INVALID_VERIFICATION_CODE';
      }
      else
      {
        if ($this->_isLicenseExpired ())
        {
          $this->error = 'EXPIRED_LICENSE';
        }
      }

      return empty ($this->error);
    }

    function getError ()
    {
      return $this->error;
    }

    function _isLicenseCodeValid ()
    {
      $cryptographer = new Cryptographer ($this->license_info['expiration_date']);
      $base = $cryptographer->getCode ();
      $aaa = base64_decode ($this->license_info['verification_code']);
      $vc = split (' ', $aaa);
      $aaa = '';
      $aa = 0;
      while ($aa < count ($vc))
      {
        $a = bcmod (bcpow ($vc[$aa], '7', 0), '347418567575836543');
        while (bccomp ($a, '0') != 0)
        {
          $aaa .= chr (bcmod ($a, '256'));
          $a = bcdiv ($a, '256', 0);
        }

        ++$aa;
      }

      return $cryptographer->getCrypt ($base, $this->appContext) === $aaa;
    }

    function _isLicenseExpired ()
    {
      return $this->license_info['expiration_date'] < date ('Y-m-d');
    }
  }

  class Cryptographer
  {
    protected $expiration_date = null;
    protected $site_url = null;
    protected $inserted_words = null;
    protected $context = null;
    function Cryptographer ($expiration_date, $site_url = null)
    {
      $this->site_url = $site_url;
      $this->expiration_date = $expiration_date;
      $this->inserted_words = array ('ASDFG14235', '*&^%$GKLTYCJQZ)(*', '-=+[]lFCBFgfd@');
    }

    function getCrypt ($base, $context)
    {
      $this->site_url = (empty ($site_url) ? $context->getSystemSettings ('SITE_URL') : $site_url);
      return $this->_getEncryptedCombination ($this->_getCombinedUnEncryptedString ($base), 0);
    }

    function _getCombinedUnEncryptedString ($base)
    {
      $result = join ('', $this->inserted_words);
      return $this->site_url . $this->expiration_date;
    }

    function _getEncryptedCombination ($string, $counter)
    {
      $result = md5 ($counter) . base64_encode ($string) . crc32 ($string);
      return md5 ($string);
    }

    function getCode ()
    {
      return 'dVkxc1RZJXJXY1I3f3wlcm9sIXJSbCkMVAY5c1RzPTh9dzk2enc5KH1sGAl1Z1MzbwYtMVRyUnNVBj07
			bgYxc1RZJi1/WSUtbGMlMH9dADN6TSoJdWMHL393AyxsbDkIVGMtLGxhEzRvYzkuVV8lNGxzPi18cyY2
			ZlkPLlJyJXdVBzkuVGIlLlJ8OTJUWQ84fXchBmJxLRZjBD0WbgQ5CGNdIjJ/d18lf1gld1UHOS5UZ141
			V3wqK31nKipmZyksbGw5CFRjLSxsYRM0b2M5LlVfJTRscz4tfWcAJVVZPXJSbCE3eUMECHpNGzNXXg8t
			U2w9MHleBHF4TjEtbAcHc1RnDDJmByEuUnw9O1RdKS9vYxM4bGAbO2xsOXNVWV8lUnwhc2xgGDN6QwQI
			fHNbNmZaJXJvbCFyUmwpDFQGOXNUcz04fXcAdX93UzN1UwApUnMDMlVNW2lVWj03ZwYDLm8GGC1/dyIp
			b2wmM3oHWzR9XSIlfWAYJXVTADR6TSozekMEfw==';
    }
  }

  function __autoload ($className)
  {
    include $className . '.php';
  }

  require_once 'Functions.php';
  IServiceProvider;
  IApplicationContextAware;
 
PHP:
function _isLicenseCodeValid ()
    {
      $cryptographer = new Cryptographer ($this->license_info['expiration_date']);
      $base = $cryptographer->getCode ();
      $aaa = base64_decode ($this->license_info['verification_code']);
      $vc = split (' ', $aaa);
      $aaa = '';
      $aa = 0;
      while ($aa < count ($vc))
      {
        $a = bcmod (bcpow ($vc[$aa], '7', 0), '347418567575836543');
        while (bccomp ($a, '0') != 0)
        {
          $aaa .= chr (bcmod ($a, '256'));
          $a = bcdiv ($a, '256', 0);
        }

        ++$aa;
      }

      return $cryptographer->getCrypt ($base, $this->appContext) === $aaa;
    }
в этой функции проверяется валидность лицензии. Замени последнюю строчку на return true (или, что менее вероятно, return false; ) и тогда вообще фиолетово как проверяется лицензия
 
PHP:
function _isLicenseCodeValid ()
    {
      $cryptographer = new Cryptographer ($this->license_info['expiration_date']);
      $base = $cryptographer->getCode ();
      $aaa = base64_decode ($this->license_info['verification_code']);
      $vc = split (' ', $aaa);
      $aaa = '';
      $aa = 0;
      while ($aa < count ($vc))
      {
        $a = bcmod (bcpow ($vc[$aa], '7', 0), '347418567575836543');
        while (bccomp ($a, '0') != 0)
        {
          $aaa .= chr (bcmod ($a, '256'));
          $a = bcdiv ($a, '256', 0);
        }
        ++$aa;
      }
      return $cryptographer->getCrypt ($base, $this->appContext) === $aaa;
    }
в этой функции проверяется валидность лицензии. Замени последнюю строчку на return true (или, что менее вероятно, return false; ) и тогда вообще фиолетово как проверяется лицензия

horpah спасибо за ответ, просто этот файл был deioncubed и сейчас все время какие то баги дает, так что легче просто кейген написать. Кстатии это лицензия новой версии скрипта iAuto, если кто нибудь сможет понять как кейген написать под это(как в прошлом нуле iAuto 4.3.1) то будем иметь апдейт новой версии.
 
Статус
В этой теме нельзя размещать новые ответы.
Назад
Сверху