Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- *
- * @ This file is created by deZender.Net
- * @ deZender (PHP5 Decoder for ionCube Encoder)
- *
- * @ Version : 1.1.4.0
- * @ Author : DeZender
- * @ Release on : 30.03.2012
- * @ Official site : http://DeZender.Net
- *
- */
- class tekssh {
- var $contyp = null;
- var $connection = null;
- var $constream = null;
- function connect($sshdaemon, $daemonpasswd, $serverip, $sshport, $sshuser, $idrsapub, $idrsa, $rootpw) {
- if ($sshdaemon == 0) {
- $this->contyp = 0;
- if (!$this->connection = ssh2_connect( $serverip, $sshport )) {
- return 'error_00001';
- }
- if ($rootpw != '') {
- if (!ssh2_auth_password( $this->connection, $sshuser, $rootpw )) {
- $this->connection = null;
- return 'error_00003';
- }
- } else {
- if (!ssh2_auth_pubkey_file( $this->connection, $sshuser, $idrsapub, $idrsa, '' )) {
- $this->connection = null;
- return 'error_00002';
- }
- }
- }
- if ($sshdaemon == 1) {
- $this->contyp = 1;
- $localserv = $_SERVER['SERVER_ADDR'];
- if ($serverip == $localserv) {
- $serverip = 'localhost';
- }
- $this->constream = @fsockopen( $serverip, $sshport, $errno, $errstr, 3 );
- if (!$this->constream) {
- fclose( $this->constream );
- $this->connection = null;
- return 'error_00001';
- }
- $d_random = rand( 3, 1000 );
- $daemonpasswd = crypt( $daemonpasswd, $d_random ) . ' ' . $d_random;
- fwrite( $this->constream, ( '' . $daemonpasswd . '
- ' ) );
- $buf = fread( $this->constream, 4096 );
- if ($buf != 'ID100') {
- fclose( $this->constream );
- $this->connection = null;
- return 'error_00004';
- }
- }
- return 'ok_00001';
- }
- function exefull($cmd) {
- if ($this->contyp == '0') {
- if (!$this->constream = ssh2_exec( $this->connection, $cmd )) {
- return 'error_00005';
- }
- stream_set_blocking( $this->constream, true );
- $data = '';
- if ($buf = fread( $this->constream, 4096 )) {
- flush( );
- $data .= $buf;
- }
- return $data;
- }
- if ($this->contyp == '1') {
- $data = '';
- fwrite( $this->constream, base64_encode( $cmd ) . '
- ' );
- while (!feof( $this->constream )) {
- $data .= fread( $this->constream, 4096 );
- }
- return $data;
- }
- return 'error_00006';
- }
- function exelite($cmd) {
- if ($this->contyp == '0') {
- if (!$this->constream = ssh2_exec( $this->connection, $cmd )) {
- return 'error_00005';
- }
- stream_set_blocking( $this->constream, true );
- $data = fread( $this->constream, 4096 );
- return $data;
- }
- if ($this->contyp == '1') {
- fwrite( $this->constream, base64_encode( $cmd ) . '
- ' );
- $data = fread( $this->constream, 4096 );
- return $data;
- }
- return 'error_00006';
- }
- function disconnect() {
- if ($this->contyp == '0') {
- $this->exelite( 'exit' );
- }
- @fclose( $this->constream );
- $this->connection = null;
- }
- function __destruct() {
- $this->disconnect( );
- }
- }
- function tekinstall($sshdaemon, $daemonpasswd, $sshport, $sshuser, $scriptpath, $user, $userid, $ftppw, $serverip, $path, $name, $typ, $status) {
- global $wioption;
- global $prefix;
- global $db;
- $tekssh = new tekssh( );
- $tekssh_stat = $tekssh->connect( $sshdaemon, $daemonpasswd, $serverip, $sshport, $sshuser, $wioption[idrsapub], $wioption[idrsa], '' );
- if ($tekssh_stat == 'ok_00001') {
- $image = '' . $wioption['imagepath'] . '/' . $name . '.tar';
- $timeout = 620;
- $old = ini_set( 'default_socket_timeout', $timeout );
- $file = fopen( '' . $image, 'r' );
- ini_set( 'default_socket_timeout', $old );
- stream_set_timeout( $file, $timeout );
- stream_set_blocking( $file, 0 );
- if ($file == FALSE) {
- $timeout = 620;
- $old = ini_set( 'default_socket_timeout', $timeout );
- $image = '' . $wioption['imagepathtwo'] . '/' . $name . '.tar';
- $file = @fopen( '' . $image, 'r' );
- ini_set( 'default_socket_timeout', $old );
- stream_set_timeout( $file, $timeout );
- stream_set_blocking( $file, 0 );
- if ($file == FALSE) {
- $imagepath = '' . $wioption['imagepath'];
- } else {
- $imagepath = '' . $wioption['imagepathtwo'];
- }
- } else {
- $imagepath = '' . $wioption['imagepath'];
- }
- if ($imagepath) {
- if ($status != 'delete') {
- $aprow = $db->sql_numrows( $db->sql_query( 'SELECT * FROM ' . $prefix . ( '' . '_applications WHERE serverip=\'' . $serverip . '\' AND memberid=\'' . $userid . '\'' ) ) );
- $gsrow = $db->sql_numrows( $db->sql_query( 'SELECT * FROM ' . $prefix . ( '' . '_gameserver WHERE serverip=\'' . $serverip . '\' AND memberid=\'' . $userid . '\'' ) ) );
- $vsrow = $db->sql_numrows( $db->sql_query( 'SELECT * FROM ' . $prefix . ( '' . '_voiceserver WHERE serverip=\'' . $serverip . '\' AND memberid=\'' . $userid . '\' AND typ!=\'Teamspeak\' AND typ!=\'Teamspeak3\'' ) ) );
- $ssrow = $db->sql_numrows( $db->sql_query( 'SELECT * FROM ' . $prefix . ( '' . '_streamserver WHERE serverip=\'' . $serverip . '\' AND memberid=\'' . $userid . '\'' ) ) );
- $virow = $db->sql_numrows( $db->sql_query( 'SELECT * FROM ' . $prefix . ( '' . '_vstreamserver WHERE serverip=\'' . $serverip . '\' AND memberid=\'' . $userid . '\'' ) ) );
- if (( ( ( ( $aprow == 0 && $gsrow == 0 ) && $vsrow == 0 ) && $ssrow == 0 ) && $virow == 0 )) {
- $cmd = '' . 'cd ' . $scriptpath . ';sudo ./tekbase 1 \'' . $user . '\' \'' . $ftppw . '\'';
- $tekssh_stat = $tekssh->exelite( $cmd );
- $tekssh_stat = substr( $tekssh_stat, 0, 3 );
- if ($tekssh_stat == 'ID1') {
- $tekssh_stat = 'ok_00001';
- } else {
- $tekssh_stat = 'error_00009';
- }
- }
- }
- if ($tekssh_stat == 'ok_00001') {
- $cmd = '' . 'cd ' . $scriptpath . ';sudo ./tekbase 5 \'' . $user . '\' \'' . $path . '\' \'' . $name . '\' \'' . $imagepath . '\' \'' . $typ . '\' \'' . $status . '\'';
- $tekssh_stat = $tekssh->exelite( $cmd );
- $tekssh_stat = substr( $tekssh_stat, 0, 3 );
- $tekssh->disconnect( );
- if ($tekssh_stat == 'ID1') {
- return 'ok_00001';
- }
- return 'error_00007';
- }
- }
- return 'error_00008';
- }
- return $tekssh_stat;
- }
- function tekdelete($sshdaemon, $daemonpasswd, $sshport, $sshuser, $scriptpath, $user, $serverip, $path, $typ) {
- global $wioption;
- $tekssh = new tekssh( );
- $tekssh_stat = $tekssh->connect( $sshdaemon, $daemonpasswd, $serverip, $sshport, $sshuser, $wioption[idrsapub], $wioption[idrsa], '' );
- if ($tekssh_stat == 'ok_00001') {
- $cmd = '' . 'cd ' . $scriptpath . ';sudo ./tekbase 7 \'' . $user . '\' \'' . $path . '\' \'' . $typ . '\'';
- $tekssh_stat = $tekssh->exelite( $cmd );
- $tekssh_stat = substr( $tekssh_stat, 0, 3 );
- $tekssh->disconnect( );
- if ($tekssh_stat == 'ID1') {
- return 'ok_00001';
- }
- return 'error_00007';
- }
- return $tekssh_stat;
- }
- function tekdeleteuser($sshdaemon, $daemonpasswd, $sshport, $sshuser, $scriptpath, $user, $serverip, $deleteall) {
- global $wioption;
- $tekssh = new tekssh( );
- $tekssh_stat = $tekssh->connect( $sshdaemon, $daemonpasswd, $serverip, $sshport, $sshuser, $wioption[idrsapub], $wioption[idrsa], '' );
- if ($tekssh_stat == 'ok_00001') {
- $cmd = '' . 'cd ' . $scriptpath . ';sudo ./tekbase 3 \'' . $user . '\' \'' . $deleteall . '\'';
- $tekssh_stat = $tekssh->exelite( $cmd );
- $tekssh_stat = substr( $tekssh_stat, 0, 3 );
- $tekssh->disconnect( );
- if ($tekssh_stat == 'ID1') {
- return 'ok_00001';
- }
- return 'error_00007';
- }
- return $tekssh_stat;
- }
- function tekmoduser($sshdaemon, $daemonpasswd, $sshport, $sshuser, $scriptpath, $user, $serverip, $ftppasswd) {
- global $wioption;
- $tekssh = new tekssh( );
- $tekssh_stat = $tekssh->connect( $sshdaemon, $daemonpasswd, $serverip, $sshport, $sshuser, $wioption[idrsapub], $wioption[idrsa], '' );
- if ($tekssh_stat == 'ok_00001') {
- $cmd = '' . 'cd ' . $scriptpath . ';sudo ./tekbase 2 \'' . $user . '\' \'' . $ftppasswd . '\'';
- $tekssh_stat = $tekssh->exelite( $cmd );
- $tekssh_stat = substr( $tekssh_stat, 0, 3 );
- $tekssh->disconnect( );
- if ($tekssh_stat == 'ID1') {
- return 'ok_00001';
- }
- return 'error_00007';
- }
- return $tekssh_stat;
- }
- function tekchmod($sshdaemon, $daemonpasswd, $sshport, $sshuser, $scriptpath, $user, $typ, $path, $files, $serverip) {
- global $wioption;
- $tekssh = new tekssh( );
- $tekssh_stat = $tekssh->connect( $sshdaemon, $daemonpasswd, $serverip, $sshport, $sshuser, $wioption[idrsapub], $wioption[idrsa], '' );
- if ($tekssh_stat == 'ok_00001') {
- $cmd = '' . 'cd ' . $scriptpath . ';sudo ./tekbase 28 \'' . $user . '\' \'' . $typ . '\' \'' . $path . '\' \'' . $files . '\'';
- $tekssh_stat = $tekssh->exelite( $cmd );
- $tekssh_stat = substr( $tekssh_stat, 0, 3 );
- $tekssh->disconnect( );
- if ($tekssh_stat == 'ID1') {
- return 'ok_00001';
- }
- return 'error_00007';
- }
- return $tekssh_stat;
- }
- function tekcopy($sshdaemon, $daemonpasswd, $sshport, $sshuser, $scriptpath, $user, $typ, $path, $files, $serverip) {
- global $wioption;
- $tekssh = new tekssh( );
- $tekssh_stat = $tekssh->connect( $sshdaemon, $daemonpasswd, $serverip, $sshport, $sshuser, $wioption[idrsapub], $wioption[idrsa], '' );
- if ($tekssh_stat == 'ok_00001') {
- $cmd = '' . 'cd ' . $scriptpath . ';sudo ./tekbase 29 \'' . $user . '\' \'' . $typ . '\' \'' . $path . '\' \'' . $files . '\'';
- $tekssh_stat = $tekssh->exelite( $cmd );
- $tekssh_stat = substr( $tekssh_stat, 0, 3 );
- $tekssh->disconnect( );
- if ($tekssh_stat == 'ID1') {
- return 'ok_00001';
- }
- return 'error_00007';
- }
- return $tekssh_stat;
- }
- function tekmd5check($sshdaemon, $daemonpasswd, $sshport, $sshuser, $scriptpath, $user, $serverip, $path, $typ) {
- global $wioption;
- $tekssh = new tekssh( );
- $tekssh_stat = $tekssh->connect( $sshdaemon, $daemonpasswd, $serverip, $sshport, $sshuser, $wioption[idrsapub], $wioption[idrsa], '' );
- if ($tekssh_stat == 'ok_00001') {
- $cmd = '' . 'cd ' . $scriptpath . ';sudo ./tekbase 30 \'' . $user . '\' \'' . $typ . '\' \'' . $path . '\'';
- $tekssh_stat = $tekssh->exelite( $cmd );
- $tekssh_stat = substr( $tekssh_stat, 0, 3 );
- $tekssh->disconnect( );
- if ($tekssh_stat == 'ID1') {
- return 'ok_00001';
- }
- return 'error_00007';
- }
- return $tekssh_stat;
- }
- function tekscript($sshdaemon, $daemonpasswd, $sshport, $sshuser, $scriptpath, $serverip) {
- global $wioption;
- $tekssh = new tekssh( );
- $tekssh_stat = $tekssh->connect( $sshdaemon, $daemonpasswd, $serverip, $sshport, $sshuser, $wioption[idrsapub], $wioption[idrsa], '' );
- if ($tekssh_stat == 'ok_00001') {
- $cmd = '' . 'cd ' . $scriptpath . ';sudo ./tekbase 18';
- $tekssh_stat = $tekssh->exelite( $cmd );
- $tekssh_stat = substr( $tekssh_stat, 0, 3 );
- $tekssh->disconnect( );
- return '' . $tekssh_stat;
- }
- return '';
- }
- function tekscriptinst($sshdaemon, $daemonpasswd, $sshport, $sshuser, $scriptpath, $serverip) {
- global $wioption;
- $tekssh = new tekssh( );
- $tekssh_stat = $tekssh->connect( $sshdaemon, $daemonpasswd, $serverip, $sshport, $sshuser, $wioption[idrsapub], $wioption[idrsa], '' );
- if ($tekssh_stat == 'ok_00001') {
- $cmd = '' . 'cd ' . $scriptpath . ';sudo ./tekbase 19';
- $tekssh_stat = $tekssh->exelite( $cmd );
- $tekssh_stat = substr( $tekssh_stat, 0, 3 );
- $tekssh->disconnect( );
- if ($tekssh_stat == 'ID1') {
- return 'ok_00001';
- }
- return 'error_00007';
- }
- return $tekssh_stat;
- }
- function tekrootstatus($sshdaemon, $daemonpasswd, $sshport, $sshuser, $scriptpath, $serverip, $typ, $trafficmonth, $trafficmonthtwo) {
- global $wioption;
- $tekssh = new tekssh( );
- $tekssh_stat = $tekssh->connect( $sshdaemon, $daemonpasswd, $serverip, $sshport, $sshuser, $wioption[idrsapub], $wioption[idrsa], '' );
- if ($tekssh_stat == 'ok_00001') {
- $cmd = ( '' . 'cd ' . $scriptpath . ';sudo ./tekbase 20 \'' . $typ . '\' "' . $trafficmonth . '" "' . $trafficmonthtwo . '"' );
- $tekssh_stat = $tekssh->exelite( $cmd );
- $tekssh->disconnect( );
- return $tekssh_stat;
- }
- return '';
- }
- function tekquota($sshdaemon, $daemonpasswd, $sshport, $sshuser, $scriptpath, $serverip, $quotapath, $vara, $varb, $varc, $vard) {
- global $wioption;
- $tekssh = new tekssh( );
- $tekssh_stat = $tekssh->connect( $sshdaemon, $daemonpasswd, $serverip, $sshport, $sshuser, $wioption[idrsapub], $wioption[idrsa], '' );
- if ($tekssh_stat == 'ok_00001') {
- $cmd = '' . 'cd ' . $scriptpath . ';sudo ./tekbase 31 \'' . $quotapath . '\' \'' . $vara . '\' \'' . $varb . '\' \'' . $varc . '\' \'' . $vard . '\'';
- $tekssh_stat = $tekssh->exelite( $cmd );
- $tekssh->disconnect( );
- return $tekssh_stat;
- }
- return $tekssh_stat;
- }
- function tekaddonexec($sshdaemon, $daemonpasswd, $sshport, $sshuser, $scriptpath, $serverip, $typ, $user, $vara, $varb, $varc, $vard, $vare, $varf, $varg, $varh) {
- global $wioption;
- $tekssh = new tekssh( );
- $tekssh_stat = $tekssh->connect( $sshdaemon, $daemonpasswd, $serverip, $sshport, $sshuser, $wioption[idrsapub], $wioption[idrsa], '' );
- if ($tekssh_stat == 'ok_00001') {
- $image = '' . $wioption['imagepath'] . '/' . $typ . '/' . $name . '.tar';
- $timeout = 475;
- $old = ini_set( 'default_socket_timeout', $timeout );
- $file = @fopen( '' . $image, 'r' );
- ini_set( 'default_socket_timeout', $old );
- stream_set_timeout( $file, $timeout );
- stream_set_blocking( $file, 0 );
- if ($file == FALSE) {
- $timeout = 475;
- $old = ini_set( 'default_socket_timeout', $timeout );
- $image = '' . $wioption['imagepathtwo'] . '/' . $name . '.tar';
- $file = @fopen( '' . $image, 'r' );
- ini_set( 'default_socket_timeout', $old );
- stream_set_timeout( $file, $timeout );
- stream_set_blocking( $file, 0 );
- if ($file == FALSE) {
- $imagepath = '' . $wioption['imagepath'];
- } else {
- $imagepath = '' . $wioption['imagepathtwo'];
- }
- } else {
- $imagepath = '' . $wioption['imagepath'];
- }
- if ($imagepath) {
- if (( $tekssh_stat == 'ok_00001' || $tekssh_stat == 'ID1' )) {
- $cmd = '' . 'cd ' . $scriptpath . ';sudo -u ' . $user . ' ./games ' . $typ . ' \'' . $user . '\' \'' . $vara . '\' \'' . $varb . '\' \'' . $varc . '\' \'' . $vard . '\' \'' . $imagepath . '\'';
- $tekssh_stat = $tekssh->exelite( $cmd );
- $tekssh_stat = substr( $tekssh_stat, 0, 3 );
- $tekssh->disconnect( );
- if ($tekssh_stat == 'ID1') {
- return 'ok_00001';
- }
- return 'error_00007';
- }
- }
- return 'error_00008';
- }
- return $tekssh_stat;
- }
- ..............................................
- .............................
- ..............
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement