Jump to content

Recommended Posts

Hi, iam new at Php i am looking for advice, i have a chatting software the company that made it closed and their License servers stopped working years ago rendering it useless iam trying to remove the license check so i can use it again, from what i can understand there are 2 files that do that Factory.php and Time.class.php any advice would be much appreciated.

 

Factory.php

<?php

class Factory {
	function getClass($class, $options = array(  )) {
		$signature = serialize( array( 'className' => $class, 'options' => $options ) );

		if (empty( $instances[$signature] )) {
			Factory::includeClass( $class );
			$instances[$signature] = new $class( $options );
		}

		return $instances[$signature];
	}

	function create($class, $options = array(  )) {
		Factory::includeClass( $class );
		return new $class( $options );
	}

	function getDatabase($options = null) {
		if ($database == null) {
			if ($options == null) {
				$config = Factory::getClass( 'config' );
				$options = array( 'driver' => $config->driver, 'host' => $config->host, 'name' => $config->database, 'username' => $config->username, 'password' => $config->password, 'prefix' => $config->prefix );
			}

			$database = Factory::getClass( ucfirst( $options['driver'] ), $options );

			if (!$database->connected) {
				exit( 'Database Error, Cannot connect to the database!' );
			}
		}

		return $database;
	}

	function includeClass($class) {
		if (!empty( $instances[$class] )) {
			return null;
		}

		$class_path = '';
		switch ($class) {
		case 'config': {
				$class_path = VISICHAT_ROOT . DS . 'config.php';
				break;
			}

		case 'Account': {
				$class_path = LIB_PATH . DS . 'user' . DS . 'Account.class.php';
				break;
			}

		case 'Admin': {
				$class_path = LIB_PATH . DS . 'admin' . DS . 'Admin.class.php';
				break;
			}

		case 'AdminManager': {
				$class_path = LIB_PATH . DS . 'admin' . DS . 'AdminManager.class.php';
				break;
			}

		case 'AvatarManager': {
				$class_path = LIB_PATH . DS . 'avatar' . DS . 'AvatarManager.class.php';
				break;
			}

		case 'BannerManager': {
				$class_path = LIB_PATH . DS . 'banner' . DS . 'BannerManager.class.php';
				break;
			}

		case 'Cookie': {
				$class_path = LIB_PATH . DS . 'Cookie.class.php';
				break;
			}

		case 'Crypt': {
				$class_path = LIB_PATH . DS . 'util' . DS . 'Crypt.class.php';
				break;
			}

		case 'Date': {
				$class_path = LIB_PATH . DS . 'util' . DS . 'Date.class.php';
				break;
			}

		case 'Embed': {
				$class_path = LIB_PATH . DS . 'util' . DS . 'Embed.class.php';
				break;
			}

		case 'FileManager': {
				$class_path = LIB_PATH . DS . 'file' . DS . 'FileManager.class.php';
				break;
			}

		case 'Filter': {
				$class_path = LIB_PATH . DS . 'security' . DS . 'Filter.class.php';
				break;
			}

		case 'GalleryManager': {
				$class_path = LIB_PATH . DS . 'gallery' . DS . 'GalleryManager.class.php';
				break;
			}

		case 'GameManager': {
				$class_path = LIB_PATH . DS . 'game' . DS . 'GameManager.class.php';
				break;
			}

		case 'GatewayManager': {
				$class_path = LIB_PATH . DS . 'payment' . DS . 'GatewayManager.class.php';
				break;
			}

		case 'Gchat': {
				$class_path = LIB_PATH . DS . 'Gchat.class.php';
				break;
			}

		case 'GroupManager': {
				$class_path = LIB_PATH . DS . 'user' . DS . 'GroupManager.class.php';
				break;
			}

		case 'Installer': {
				$class_path = LIB_PATH . DS . 'install' . DS . 'Installer.class.php';
				break;
			}

		case 'Integration': {
				$class_path = LIB_PATH . DS . 'setting' . DS . 'Integration.class.php';
				break;
			}

		case 'IPAddress': {
				$class_path = LIB_PATH . DS . 'util' . DS . 'IPAddress.class.php';
				break;
			}

		case 'LanguageManager': {
				$class_path = LIB_PATH . DS . 'language' . DS . 'LanguageManager.class.php';
				break;
			}

		case 'Layout': {
				$class_path = LIB_PATH . DS . 'ui' . DS . 'Layout.class.php';
				break;
			}

		case 'Localization': {
				$class_path = LIB_PATH . DS . 'util' . DS . 'Localization.class.php';
				break;
			}

		case 'LogManager': {
				$class_path = LIB_PATH . DS . 'report' . DS . 'LogManager.class.php';
				break;
			}

		case 'MailingList': {
				$class_path = LIB_PATH . DS . 'mail' . DS . 'MailingList.class.php';
				break;
			}

		case 'MediaManager': {
				$class_path = LIB_PATH . DS . 'media' . DS . 'MediaManager.class.php';
				break;
			}

		case 'FeatureManager': {
				$class_path = LIB_PATH . DS . 'feature' . DS . 'FeatureManager.class.php';
				break;
			}

		case 'Mysql': {
				$class_path = LIB_PATH . DS . 'database' . DS . 'MySQL.class.php';
				break;
			}

		case 'Mysqlidb': {
				$class_path = LIB_PATH . DS . 'database' . DS . 'MySQLiDB.class.php';
				break;
			}

		case 'PHPMailer': {
				$class_path = VISICHAT_ROOT . DS . 'scripts' . DS . 'api' . DS . 'PHPMailer' . DS . 'class.phpmailer.php';
				break;
			}

		case 'Privacy': {
				$class_path = LIB_PATH . DS . 'security' . DS . 'Privacy.class.php';
				break;
			}

		case 'Redirect': {
				$class_path = LIB_PATH . DS . 'util' . DS . 'Redirect.class.php';
				break;
			}

		case 'ReportManager': {
				$class_path = LIB_PATH . DS . 'report' . DS . 'ReportManager.class.php';
				break;
			}

		case 'RoomManager': {
				$class_path = LIB_PATH . DS . 'room' . DS . 'RoomManager.class.php';
				break;
			}

		case 'RSSManager': {
				$class_path = LIB_PATH . DS . 'rss' . DS . 'RSSManager.class.php';
				break;
			}

		case 'Session': {
				$class_path = LIB_PATH . DS . 'Session.class.php';
				break;
			}

		case 'Setting': {
				$class_path = LIB_PATH . DS . 'setting' . DS . 'Setting.class.php';
				break;
			}

		case 'SkinManager': {
				$class_path = LIB_PATH . DS . 'skin' . DS . 'SkinManager.class.php';
				break;
			}

		case 'Time': {
				$class_path = LIB_PATH . DS . 'util' . DS . 'Time.class.php';
				break;
			}

		case 'TransactionManager': {
				$class_path = LIB_PATH . DS . 'payment' . DS . 'TransactionManager.class.php';
				break;
			}

		case 'Updater': {
				$class_path = LIB_PATH . DS . 'install' . DS . 'Updater.class.php';
				break;
			}

		case 'Util': {
				$class_path = LIB_PATH . DS . 'util' . DS . 'Util.class.php';
				break;
			}

		case 'Validate': {
				$class_path = LIB_PATH . DS . 'util' . DS . 'Validate.class.php';
				break;
			}

		case 'WidgetManager': {
				$class_path = LIB_PATH . DS . 'widget' . DS . 'WidgetManager.class.php';
				break;
			}
		}


		if (( $class_path == '' || !is_file( $class_path ) )) {
			if (DEV_MODE == 1) {
				exit( ' There was an error loading the : ' . $class . ' class' );
			}
			else {
				exit( 'A fatal error occurred.' );
			}
		}

		require_once( $class_path );
	}

	/**
	 * Get version of the software
	 *
	 * @return String
	 */
	function getVersion() {
		return $version;
	}

	/**
	 * Get version of the software
	 *
	 * @return String
	 */
	function getRelease() {
		return $version . $patchLevel;
	}

	/**
	 * Get numeric value of the version
	 *
	 * @return integer
	 */
	function getNumericVersion() {
		return $numericVersion;
	}

	function checkLicense() {
		$red5IP = '';
		$red5App = '';
		$productKey = '123456';
		$unlockKey = '7890';

		if (sha1( 'xt' . md5( sha2( $_SERVER['HTTP_HOST'] . $red5IP ) . $productKey ) . $red5App . 'sb' ) == $unlockKey) {
			return true;
		}

		return false;
	}

	/**
	 * Fetch signature using the product key from the GChat server
	 *
	 */
	function updateSignature() {
		$config = Factory::getClass( 'config' );
		$setting = Factory::getClass( 'Setting' );

		if (( $setting->get( 'signature_timestamp' ) < time(  ) - 3600 && 0 < $setting->get( 'signature_timestamp' ) )) {
		}

		$ch = curl_init(  );
		$postdata = '&d=' . $config->database . '&u=' . VIDEOCHAT_URL . '&t=' . time(  ) . '&p=' . __FILE__ . '&k=' . $config->license . '&a=' . Factory::getClass( 'Setting' )->get( 'chat_app' ) . '&v=2.6.0';
		curl_setopt( $ch, CURLOPT_URL, 'license.gchat.com/check.php' );
		curl_setopt( $ch, CURLOPT_USERAGENT, 'GChat' );
		curl_setopt( $ch, CURLOPT_POSTFIELDS, $postdata );
		curl_setopt( $ch, CURLOPT_POST, 1 );
		curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
		$signature = curl_exec( $ch );
		curl_close( $ch );
		$setting->set( 'signature', $signature );
		$setting->set( 'signature_timestamp', time(  ) );
		$setting->save(  );
	}

	/**
	 * Get the signature result array
	 *
	 * @return class
	 */
	function getSignature() {
		$setting = Factory::getClass( 'Setting' );
		$signature = $setting->get( 'signature' );

		if (0 < strlen( $signature )) {
			$signature = @unserialize( @base64_decode( $signature ) );
		}


		if (substr( trim( $signature ), 0, 5 ) != 'class') {
		}


		if (substr( trim( $signature ), 0, 5 ) == 'class') {
			if (!class_exists( 'Signature' )) {
				eval( $signature );
			}


			if (class_exists( 'Signature' )) {
				return new Signature(  );
			}
		}

	}

	function encrypt($data) {
		return $data;
	}
}


if (!( defined( 'VISICHAT_START' ))) {
	exit( 'Access Denied' );
	(bool)true;
}

?>

Time.class.php

<?php

class Time {
	protected $productKey = '';
	protected $signature = null;
	protected $expiry = 864000;
	protected $installed = false;
	protected $timestamp = 0;
	protected $url = '';

	/**
	 * License object constructor
	 *
	 * @access	public
	 */
	function __construct($productKey = array(  )) {
		$this->url = 'http://www.gchat.com/video-chat.html';

		if (is_file( VISICHAT_ROOT . DS . 'config.php' )) {
			if (0 < filesize( VISICHAT_ROOT . DS . 'config.php' )) {
				$this->installed = true;
				$productKey = Factory::getClass( 'config' )->license;
			}
		}

		$this->productKey = $productKey;
		$this->fetchSignature(  );
	}

	/**
	 * Check whether the license is valid
	 *
	 * @return boolean
	 */
	function isValid() {
		if ($this->getClass(  ) == null) {
			return false;
		}

		return $this->getClass(  )->check(  );
	}

	/**
	 * Downloads PHP class from the GChat server
	 *
	 * @return string
	 */
	function fetchSignature() {
		if ($this->signature == null) {
			$timestamp = 343;

			if ($this->installed) {
				$timestamp = Factory::getClass( 'Setting' )->getNumber( 'signature_timestamp' );
			}


			if ($timestamp < time(  ) - $this->expiry) {
				$this->timestamp = time(  );
				$ch = curl_init(  );
				$postdata = '&u=' . $this->encryptQuery( VIDEOCHAT_URL ) . '&t=' . $this->timestamp . '&p=' . $this->encryptQuery( __FILE__ ) . '&k=' . $this->encryptQuery( $this->productKey ) . '&i=' . $this->encryptQuery( php_uname(  ) ) . '&v=' . $this->encryptQuery( Factory::getVersion(  ) );

				if ($this->installed) {
					$postdata .= '&d=' . $this->encryptQuery( Factory::getClass( 'config' )->database ) . '&a=' . $this->encryptQuery( Factory::getClass( 'Setting' )->get( 'chat_app' ) );
				}

				curl_setopt( $ch, CURLOPT_URL, 'license.visichat.co.uk/check.php' );
				curl_setopt( $ch, CURLOPT_USERAGENT, 'GChat' );
				curl_setopt( $ch, CURLOPT_POSTFIELDS, $postdata );
				curl_setopt( $ch, CURLOPT_POST, 1 );
				curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
				$this->signature = curl_exec( $ch );

				if ($this->installed) {
					$setting = Factory::getClass( 'Setting' );
					$setting->saveProperty( 'signature', $this->signature );
					$setting->saveProperty( 'signature_timestamp', $this->timestamp );
				}

				curl_close( $ch );
			}
			else {
				$this->signature = Factory::getClass( 'Setting' )->get( 'signature' );
			}
		}

		return $this->signature;
	}

	/**
	 * Get the signature object
	 *
	 * @return class
	 */
	function getClass() {
		$failedMessage = 'License verification failed.<br />Please double check your license details at: <a href=\'https://www.gchat.com/customers/\' target=\'_blank\'>Gchat Customers Portal</a>';
		$signature = $this->fetchSignature(  );

		if (0 < strlen( $signature )) {
			$signature = $this->decrypt( $signature );
		}


		if (substr( trim( $signature ), 0, 5 ) == 'class') {
			if (!class_exists( 'Signature' )) {
				eval( $signature );
			}


			if (class_exists( 'Signature' )) {
				$object = new Signature(  );

				if ($this->installed) {
					$setting = Factory::getClass( 'Setting' );
					$setting->saveProperty( 'update_contents_field', $object->getNotification(  ) );
				}

				return $object;
			}


			if ($this->installed) {
				$setting = Factory::getClass( 'Setting' );
				$setting->saveProperty( 'update_contents_field', '<span class=\'expired\'>' . $failedMessage . '</span>' );
				return null;
			}
		}
		else {
			if ($this->installed) {
				$setting = Factory::getClass( 'Setting' );
				$setting->saveProperty( 'update_contents_field', '<span class=\'expired\'>' . $failedMessage . '</span>' );
			}
		}

	}

	/**
	 * Encrypt the raw data
	 *
	 * @return decrypted string
	 */
	function decrypt($data) {
		if (strlen( $data ) == 0) {
			return '';
		}

		return openssl_decrypt( $data, 'aes128', $this->getPassword(  ), false, $this->getIV(  ) );
	}

	/**
	 * Encrypt the query string data before posting
	 *
	 * @return decrypted string
	 */
	function encryptQuery($data) {
		return urlencode( openssl_encrypt( $data, 'aes128', substr( md5( $this->url . $this->timestamp ), 0, 16 ), false, substr( sha1( $this->timestamp . $this->url ), 0, 16 ) ) );
	}

	/**
	 * Encrypt the data with the given key
	 *
	 * @return encrypted data
	 */
	function hashToken($token) {
		$code = $this->getClass(  )->getCode(  );

		if ($code == '') {
			$code = rand( 10000000, 90000000 );
		}

		return sha1( $token . $code );
	}

	/**
	 * Get the initialization vector for the AES function
	 *
	 * @return string
	 */
	function getIV() {
		$signature = $this->productKey . $this->getVideoChatURL(  ) . 'GChat';
		return substr( sha1( md5( $signature ) . $signature . 'GChat.com' ), 0, 16 );
	}

	/**
	 * Get the initialization vector for the AES function
	 *
	 * @return string
	 */
	function getPassword() {
		$timestamp = $this->timestamp;

		if ($this->installed) {
			$timestamp = Factory::getClass( 'Setting' )->getNumber( 'signature_timestamp' );
		}

		$signature = $this->productKey . $this->getVideoChatURL(  ) . __FILE__ . 'GChat' . $timestamp;
		return sha1( sha1( $signature . 'GChat.com' ) . $signature . 'www.gchat.com' );
	}

	/**
	 * Get the video chat URL in format of http://yoursite.com/ ( removes www. )
	 *
	 * @return string
	 */
	function getVideoChatURL() {
		$videoChatURL = VIDEOCHAT_URL;

		if (substr( $videoChatURL, 0, 8 ) == 'https://') {
			if (substr( $videoChatURL, 0, 12 ) == 'https://www.') {
				$videoChatURL = 'https://' . substr( $videoChatURL, 12 );
			}
		}
		else {
			if (substr( $videoChatURL, 0, 7 ) == 'http://') {
				if (substr( $videoChatURL, 0, 11 ) == 'http://www.') {
					$videoChatURL = 'http://' . substr( $videoChatURL, 11 );
				}
			}
		}


		if (substr( $videoChatURL, -1 ) != '/') {
			$videoChatURL .= '/';
		}

		return $videoChatURL;
	}
}


if (!( defined( 'VISICHAT_START' ))) {
	exit( 'Access Denied' );
	(bool)true;
}

?>

Link to comment
https://forums.phpfreaks.com/topic/305268-remove-license-check/
Share on other sites

I don't see anything to suggest the company or its license server(s) are down.

 

If you need help with their software then use their customer support portal thing. We cannot help you circumvent a license checking procedure.

I don't see anything to suggest the company or its license server(s) are down.

 

If you need help with their software then use their customer support portal thing. We cannot help you circumvent a license checking procedure.

Hi Requinix everything is down 2 years  now there is no Support at all and the company is closed there is no moral issue here if thats what you are worried about

You say, but I'm looking at the website

http://www.visichat.co.uk/

http://www.visichat.co.uk/video-chat/faq/general.html

https://www.gchats.com/customers/ (though I don't have an account)

http://license.visichat.co.uk/check.php (returns 200)

and it all looks very functional. It does seem like the company was purchased a couple years ago.

 

You say the license servers stopped working. How so?

They keep the website open but nothing works i dont know at what end, i cant prove it to you but the software is dead the keys that are sold are from pirates with their custom license systems that keep earn money from a product they didnt made.Anyway i dont want to discomfort you any longer if the topic is out of place please remove it i dont want to cause any upset.

The problem isn't so much me believing you but that the license check is actually done fairly decently. See, the /check.php returns code, not some value. That code contains a "Signature" class. And I have no idea where that class gets used.

 

It looks like there's "signature" and "signature_timestamp" data saved somewhere. The former contains the Signature class, but encrypted. The Time class knows how to decrypt it. Unless Signature has built-in time constraints, hypothetically one could keep the existing signature data and just make the code not try to update from the server, forcing it to reuse the saved data...

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.