Advertisement
Guest User

Untitled

a guest
May 17th, 2012
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.75 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by deZender.Net
  5. * @ deZender (PHP5 Decoder for ionCube Encoder)
  6. *
  7. * @ Version : 1.1.4.0
  8. * @ Author : DeZender
  9. * @ Release on : 30.03.2012
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. class tekssh {
  15. var $contyp = null;
  16. var $connection = null;
  17. var $constream = null;
  18.  
  19. function connect($sshdaemon, $daemonpasswd, $serverip, $sshport, $sshuser, $idrsapub, $idrsa, $rootpw) {
  20. if ($sshdaemon == 0) {
  21. $this->contyp = 0;
  22.  
  23. if (!$this->connection = ssh2_connect( $serverip, $sshport )) {
  24. return 'error_00001';
  25. }
  26.  
  27.  
  28. if ($rootpw != '') {
  29. if (!ssh2_auth_password( $this->connection, $sshuser, $rootpw )) {
  30. $this->connection = null;
  31. return 'error_00003';
  32. }
  33. } else {
  34. if (!ssh2_auth_pubkey_file( $this->connection, $sshuser, $idrsapub, $idrsa, '' )) {
  35. $this->connection = null;
  36. return 'error_00002';
  37. }
  38. }
  39. }
  40.  
  41.  
  42. if ($sshdaemon == 1) {
  43. $this->contyp = 1;
  44. $localserv = $_SERVER['SERVER_ADDR'];
  45.  
  46. if ($serverip == $localserv) {
  47. $serverip = 'localhost';
  48. }
  49.  
  50. $this->constream = @fsockopen( $serverip, $sshport, $errno, $errstr, 3 );
  51.  
  52. if (!$this->constream) {
  53. fclose( $this->constream );
  54. $this->connection = null;
  55. return 'error_00001';
  56. }
  57.  
  58. $d_random = rand( 3, 1000 );
  59. $daemonpasswd = crypt( $daemonpasswd, $d_random ) . ' ' . $d_random;
  60. fwrite( $this->constream, ( '' . $daemonpasswd . '
  61. ' ) );
  62. $buf = fread( $this->constream, 4096 );
  63.  
  64. if ($buf != 'ID100') {
  65. fclose( $this->constream );
  66. $this->connection = null;
  67. return 'error_00004';
  68. }
  69. }
  70.  
  71. return 'ok_00001';
  72. }
  73.  
  74. function exefull($cmd) {
  75. if ($this->contyp == '0') {
  76. if (!$this->constream = ssh2_exec( $this->connection, $cmd )) {
  77. return 'error_00005';
  78. }
  79.  
  80. stream_set_blocking( $this->constream, true );
  81. $data = '';
  82.  
  83. if ($buf = fread( $this->constream, 4096 )) {
  84. flush( );
  85. $data .= $buf;
  86. }
  87.  
  88. return $data;
  89. }
  90.  
  91.  
  92. if ($this->contyp == '1') {
  93. $data = '';
  94. fwrite( $this->constream, base64_encode( $cmd ) . '
  95. ' );
  96.  
  97. while (!feof( $this->constream )) {
  98. $data .= fread( $this->constream, 4096 );
  99. }
  100.  
  101. return $data;
  102. }
  103.  
  104. return 'error_00006';
  105. }
  106.  
  107. function exelite($cmd) {
  108. if ($this->contyp == '0') {
  109. if (!$this->constream = ssh2_exec( $this->connection, $cmd )) {
  110. return 'error_00005';
  111. }
  112.  
  113. stream_set_blocking( $this->constream, true );
  114. $data = fread( $this->constream, 4096 );
  115. return $data;
  116. }
  117.  
  118.  
  119. if ($this->contyp == '1') {
  120. fwrite( $this->constream, base64_encode( $cmd ) . '
  121. ' );
  122. $data = fread( $this->constream, 4096 );
  123. return $data;
  124. }
  125.  
  126. return 'error_00006';
  127. }
  128.  
  129. function disconnect() {
  130. if ($this->contyp == '0') {
  131. $this->exelite( 'exit' );
  132. }
  133.  
  134. @fclose( $this->constream );
  135. $this->connection = null;
  136. }
  137.  
  138. function __destruct() {
  139. $this->disconnect( );
  140. }
  141. }
  142.  
  143. function tekinstall($sshdaemon, $daemonpasswd, $sshport, $sshuser, $scriptpath, $user, $userid, $ftppw, $serverip, $path, $name, $typ, $status) {
  144. global $wioption;
  145. global $prefix;
  146. global $db;
  147.  
  148. $tekssh = new tekssh( );
  149. $tekssh_stat = $tekssh->connect( $sshdaemon, $daemonpasswd, $serverip, $sshport, $sshuser, $wioption[idrsapub], $wioption[idrsa], '' );
  150.  
  151. if ($tekssh_stat == 'ok_00001') {
  152. $image = '' . $wioption['imagepath'] . '/' . $name . '.tar';
  153. $timeout = 620;
  154. $old = ini_set( 'default_socket_timeout', $timeout );
  155. $file = fopen( '' . $image, 'r' );
  156. ini_set( 'default_socket_timeout', $old );
  157. stream_set_timeout( $file, $timeout );
  158. stream_set_blocking( $file, 0 );
  159.  
  160. if ($file == FALSE) {
  161. $timeout = 620;
  162. $old = ini_set( 'default_socket_timeout', $timeout );
  163. $image = '' . $wioption['imagepathtwo'] . '/' . $name . '.tar';
  164. $file = @fopen( '' . $image, 'r' );
  165. ini_set( 'default_socket_timeout', $old );
  166. stream_set_timeout( $file, $timeout );
  167. stream_set_blocking( $file, 0 );
  168.  
  169. if ($file == FALSE) {
  170. $imagepath = '' . $wioption['imagepath'];
  171. } else {
  172. $imagepath = '' . $wioption['imagepathtwo'];
  173. }
  174. } else {
  175. $imagepath = '' . $wioption['imagepath'];
  176. }
  177.  
  178.  
  179. if ($imagepath) {
  180. if ($status != 'delete') {
  181. $aprow = $db->sql_numrows( $db->sql_query( 'SELECT * FROM ' . $prefix . ( '' . '_applications WHERE serverip=\'' . $serverip . '\' AND memberid=\'' . $userid . '\'' ) ) );
  182. $gsrow = $db->sql_numrows( $db->sql_query( 'SELECT * FROM ' . $prefix . ( '' . '_gameserver WHERE serverip=\'' . $serverip . '\' AND memberid=\'' . $userid . '\'' ) ) );
  183. $vsrow = $db->sql_numrows( $db->sql_query( 'SELECT * FROM ' . $prefix . ( '' . '_voiceserver WHERE serverip=\'' . $serverip . '\' AND memberid=\'' . $userid . '\' AND typ!=\'Teamspeak\' AND typ!=\'Teamspeak3\'' ) ) );
  184. $ssrow = $db->sql_numrows( $db->sql_query( 'SELECT * FROM ' . $prefix . ( '' . '_streamserver WHERE serverip=\'' . $serverip . '\' AND memberid=\'' . $userid . '\'' ) ) );
  185. $virow = $db->sql_numrows( $db->sql_query( 'SELECT * FROM ' . $prefix . ( '' . '_vstreamserver WHERE serverip=\'' . $serverip . '\' AND memberid=\'' . $userid . '\'' ) ) );
  186.  
  187. if (( ( ( ( $aprow == 0 && $gsrow == 0 ) && $vsrow == 0 ) && $ssrow == 0 ) && $virow == 0 )) {
  188. $cmd = '' . 'cd ' . $scriptpath . ';sudo ./tekbase 1 \'' . $user . '\' \'' . $ftppw . '\'';
  189. $tekssh_stat = $tekssh->exelite( $cmd );
  190. $tekssh_stat = substr( $tekssh_stat, 0, 3 );
  191.  
  192. if ($tekssh_stat == 'ID1') {
  193. $tekssh_stat = 'ok_00001';
  194. } else {
  195. $tekssh_stat = 'error_00009';
  196. }
  197. }
  198. }
  199.  
  200.  
  201. if ($tekssh_stat == 'ok_00001') {
  202. $cmd = '' . 'cd ' . $scriptpath . ';sudo ./tekbase 5 \'' . $user . '\' \'' . $path . '\' \'' . $name . '\' \'' . $imagepath . '\' \'' . $typ . '\' \'' . $status . '\'';
  203. $tekssh_stat = $tekssh->exelite( $cmd );
  204. $tekssh_stat = substr( $tekssh_stat, 0, 3 );
  205. $tekssh->disconnect( );
  206.  
  207. if ($tekssh_stat == 'ID1') {
  208. return 'ok_00001';
  209. }
  210.  
  211. return 'error_00007';
  212. }
  213. }
  214.  
  215. return 'error_00008';
  216. }
  217.  
  218. return $tekssh_stat;
  219. }
  220.  
  221. function tekdelete($sshdaemon, $daemonpasswd, $sshport, $sshuser, $scriptpath, $user, $serverip, $path, $typ) {
  222. global $wioption;
  223.  
  224. $tekssh = new tekssh( );
  225. $tekssh_stat = $tekssh->connect( $sshdaemon, $daemonpasswd, $serverip, $sshport, $sshuser, $wioption[idrsapub], $wioption[idrsa], '' );
  226.  
  227. if ($tekssh_stat == 'ok_00001') {
  228. $cmd = '' . 'cd ' . $scriptpath . ';sudo ./tekbase 7 \'' . $user . '\' \'' . $path . '\' \'' . $typ . '\'';
  229. $tekssh_stat = $tekssh->exelite( $cmd );
  230. $tekssh_stat = substr( $tekssh_stat, 0, 3 );
  231. $tekssh->disconnect( );
  232.  
  233. if ($tekssh_stat == 'ID1') {
  234. return 'ok_00001';
  235. }
  236.  
  237. return 'error_00007';
  238. }
  239.  
  240. return $tekssh_stat;
  241. }
  242.  
  243. function tekdeleteuser($sshdaemon, $daemonpasswd, $sshport, $sshuser, $scriptpath, $user, $serverip, $deleteall) {
  244. global $wioption;
  245.  
  246. $tekssh = new tekssh( );
  247. $tekssh_stat = $tekssh->connect( $sshdaemon, $daemonpasswd, $serverip, $sshport, $sshuser, $wioption[idrsapub], $wioption[idrsa], '' );
  248.  
  249. if ($tekssh_stat == 'ok_00001') {
  250. $cmd = '' . 'cd ' . $scriptpath . ';sudo ./tekbase 3 \'' . $user . '\' \'' . $deleteall . '\'';
  251. $tekssh_stat = $tekssh->exelite( $cmd );
  252. $tekssh_stat = substr( $tekssh_stat, 0, 3 );
  253. $tekssh->disconnect( );
  254.  
  255. if ($tekssh_stat == 'ID1') {
  256. return 'ok_00001';
  257. }
  258.  
  259. return 'error_00007';
  260. }
  261.  
  262. return $tekssh_stat;
  263. }
  264.  
  265. function tekmoduser($sshdaemon, $daemonpasswd, $sshport, $sshuser, $scriptpath, $user, $serverip, $ftppasswd) {
  266. global $wioption;
  267.  
  268. $tekssh = new tekssh( );
  269. $tekssh_stat = $tekssh->connect( $sshdaemon, $daemonpasswd, $serverip, $sshport, $sshuser, $wioption[idrsapub], $wioption[idrsa], '' );
  270.  
  271. if ($tekssh_stat == 'ok_00001') {
  272. $cmd = '' . 'cd ' . $scriptpath . ';sudo ./tekbase 2 \'' . $user . '\' \'' . $ftppasswd . '\'';
  273. $tekssh_stat = $tekssh->exelite( $cmd );
  274. $tekssh_stat = substr( $tekssh_stat, 0, 3 );
  275. $tekssh->disconnect( );
  276.  
  277. if ($tekssh_stat == 'ID1') {
  278. return 'ok_00001';
  279. }
  280.  
  281. return 'error_00007';
  282. }
  283.  
  284. return $tekssh_stat;
  285. }
  286.  
  287. function tekchmod($sshdaemon, $daemonpasswd, $sshport, $sshuser, $scriptpath, $user, $typ, $path, $files, $serverip) {
  288. global $wioption;
  289.  
  290. $tekssh = new tekssh( );
  291. $tekssh_stat = $tekssh->connect( $sshdaemon, $daemonpasswd, $serverip, $sshport, $sshuser, $wioption[idrsapub], $wioption[idrsa], '' );
  292.  
  293. if ($tekssh_stat == 'ok_00001') {
  294. $cmd = '' . 'cd ' . $scriptpath . ';sudo ./tekbase 28 \'' . $user . '\' \'' . $typ . '\' \'' . $path . '\' \'' . $files . '\'';
  295. $tekssh_stat = $tekssh->exelite( $cmd );
  296. $tekssh_stat = substr( $tekssh_stat, 0, 3 );
  297. $tekssh->disconnect( );
  298.  
  299. if ($tekssh_stat == 'ID1') {
  300. return 'ok_00001';
  301. }
  302.  
  303. return 'error_00007';
  304. }
  305.  
  306. return $tekssh_stat;
  307. }
  308.  
  309. function tekcopy($sshdaemon, $daemonpasswd, $sshport, $sshuser, $scriptpath, $user, $typ, $path, $files, $serverip) {
  310. global $wioption;
  311.  
  312. $tekssh = new tekssh( );
  313. $tekssh_stat = $tekssh->connect( $sshdaemon, $daemonpasswd, $serverip, $sshport, $sshuser, $wioption[idrsapub], $wioption[idrsa], '' );
  314.  
  315. if ($tekssh_stat == 'ok_00001') {
  316. $cmd = '' . 'cd ' . $scriptpath . ';sudo ./tekbase 29 \'' . $user . '\' \'' . $typ . '\' \'' . $path . '\' \'' . $files . '\'';
  317. $tekssh_stat = $tekssh->exelite( $cmd );
  318. $tekssh_stat = substr( $tekssh_stat, 0, 3 );
  319. $tekssh->disconnect( );
  320.  
  321. if ($tekssh_stat == 'ID1') {
  322. return 'ok_00001';
  323. }
  324.  
  325. return 'error_00007';
  326. }
  327.  
  328. return $tekssh_stat;
  329. }
  330.  
  331. function tekmd5check($sshdaemon, $daemonpasswd, $sshport, $sshuser, $scriptpath, $user, $serverip, $path, $typ) {
  332. global $wioption;
  333.  
  334. $tekssh = new tekssh( );
  335. $tekssh_stat = $tekssh->connect( $sshdaemon, $daemonpasswd, $serverip, $sshport, $sshuser, $wioption[idrsapub], $wioption[idrsa], '' );
  336.  
  337. if ($tekssh_stat == 'ok_00001') {
  338. $cmd = '' . 'cd ' . $scriptpath . ';sudo ./tekbase 30 \'' . $user . '\' \'' . $typ . '\' \'' . $path . '\'';
  339. $tekssh_stat = $tekssh->exelite( $cmd );
  340. $tekssh_stat = substr( $tekssh_stat, 0, 3 );
  341. $tekssh->disconnect( );
  342.  
  343. if ($tekssh_stat == 'ID1') {
  344. return 'ok_00001';
  345. }
  346.  
  347. return 'error_00007';
  348. }
  349.  
  350. return $tekssh_stat;
  351. }
  352.  
  353. function tekscript($sshdaemon, $daemonpasswd, $sshport, $sshuser, $scriptpath, $serverip) {
  354. global $wioption;
  355.  
  356. $tekssh = new tekssh( );
  357. $tekssh_stat = $tekssh->connect( $sshdaemon, $daemonpasswd, $serverip, $sshport, $sshuser, $wioption[idrsapub], $wioption[idrsa], '' );
  358.  
  359. if ($tekssh_stat == 'ok_00001') {
  360. $cmd = '' . 'cd ' . $scriptpath . ';sudo ./tekbase 18';
  361. $tekssh_stat = $tekssh->exelite( $cmd );
  362. $tekssh_stat = substr( $tekssh_stat, 0, 3 );
  363. $tekssh->disconnect( );
  364. return '' . $tekssh_stat;
  365. }
  366.  
  367. return '';
  368. }
  369.  
  370. function tekscriptinst($sshdaemon, $daemonpasswd, $sshport, $sshuser, $scriptpath, $serverip) {
  371. global $wioption;
  372.  
  373. $tekssh = new tekssh( );
  374. $tekssh_stat = $tekssh->connect( $sshdaemon, $daemonpasswd, $serverip, $sshport, $sshuser, $wioption[idrsapub], $wioption[idrsa], '' );
  375.  
  376. if ($tekssh_stat == 'ok_00001') {
  377. $cmd = '' . 'cd ' . $scriptpath . ';sudo ./tekbase 19';
  378. $tekssh_stat = $tekssh->exelite( $cmd );
  379. $tekssh_stat = substr( $tekssh_stat, 0, 3 );
  380. $tekssh->disconnect( );
  381.  
  382. if ($tekssh_stat == 'ID1') {
  383. return 'ok_00001';
  384. }
  385.  
  386. return 'error_00007';
  387. }
  388.  
  389. return $tekssh_stat;
  390. }
  391.  
  392. function tekrootstatus($sshdaemon, $daemonpasswd, $sshport, $sshuser, $scriptpath, $serverip, $typ, $trafficmonth, $trafficmonthtwo) {
  393. global $wioption;
  394.  
  395. $tekssh = new tekssh( );
  396. $tekssh_stat = $tekssh->connect( $sshdaemon, $daemonpasswd, $serverip, $sshport, $sshuser, $wioption[idrsapub], $wioption[idrsa], '' );
  397.  
  398. if ($tekssh_stat == 'ok_00001') {
  399. $cmd = ( '' . 'cd ' . $scriptpath . ';sudo ./tekbase 20 \'' . $typ . '\' "' . $trafficmonth . '" "' . $trafficmonthtwo . '"' );
  400. $tekssh_stat = $tekssh->exelite( $cmd );
  401. $tekssh->disconnect( );
  402. return $tekssh_stat;
  403. }
  404.  
  405. return '';
  406. }
  407.  
  408. function tekquota($sshdaemon, $daemonpasswd, $sshport, $sshuser, $scriptpath, $serverip, $quotapath, $vara, $varb, $varc, $vard) {
  409. global $wioption;
  410.  
  411. $tekssh = new tekssh( );
  412. $tekssh_stat = $tekssh->connect( $sshdaemon, $daemonpasswd, $serverip, $sshport, $sshuser, $wioption[idrsapub], $wioption[idrsa], '' );
  413.  
  414. if ($tekssh_stat == 'ok_00001') {
  415. $cmd = '' . 'cd ' . $scriptpath . ';sudo ./tekbase 31 \'' . $quotapath . '\' \'' . $vara . '\' \'' . $varb . '\' \'' . $varc . '\' \'' . $vard . '\'';
  416. $tekssh_stat = $tekssh->exelite( $cmd );
  417. $tekssh->disconnect( );
  418. return $tekssh_stat;
  419. }
  420.  
  421. return $tekssh_stat;
  422. }
  423.  
  424. function tekaddonexec($sshdaemon, $daemonpasswd, $sshport, $sshuser, $scriptpath, $serverip, $typ, $user, $vara, $varb, $varc, $vard, $vare, $varf, $varg, $varh) {
  425. global $wioption;
  426.  
  427. $tekssh = new tekssh( );
  428. $tekssh_stat = $tekssh->connect( $sshdaemon, $daemonpasswd, $serverip, $sshport, $sshuser, $wioption[idrsapub], $wioption[idrsa], '' );
  429.  
  430. if ($tekssh_stat == 'ok_00001') {
  431. $image = '' . $wioption['imagepath'] . '/' . $typ . '/' . $name . '.tar';
  432. $timeout = 475;
  433. $old = ini_set( 'default_socket_timeout', $timeout );
  434. $file = @fopen( '' . $image, 'r' );
  435. ini_set( 'default_socket_timeout', $old );
  436. stream_set_timeout( $file, $timeout );
  437. stream_set_blocking( $file, 0 );
  438.  
  439. if ($file == FALSE) {
  440. $timeout = 475;
  441. $old = ini_set( 'default_socket_timeout', $timeout );
  442. $image = '' . $wioption['imagepathtwo'] . '/' . $name . '.tar';
  443. $file = @fopen( '' . $image, 'r' );
  444. ini_set( 'default_socket_timeout', $old );
  445. stream_set_timeout( $file, $timeout );
  446. stream_set_blocking( $file, 0 );
  447.  
  448. if ($file == FALSE) {
  449. $imagepath = '' . $wioption['imagepath'];
  450. } else {
  451. $imagepath = '' . $wioption['imagepathtwo'];
  452. }
  453. } else {
  454. $imagepath = '' . $wioption['imagepath'];
  455. }
  456.  
  457.  
  458. if ($imagepath) {
  459. if (( $tekssh_stat == 'ok_00001' || $tekssh_stat == 'ID1' )) {
  460. $cmd = '' . 'cd ' . $scriptpath . ';sudo -u ' . $user . ' ./games ' . $typ . ' \'' . $user . '\' \'' . $vara . '\' \'' . $varb . '\' \'' . $varc . '\' \'' . $vard . '\' \'' . $imagepath . '\'';
  461. $tekssh_stat = $tekssh->exelite( $cmd );
  462. $tekssh_stat = substr( $tekssh_stat, 0, 3 );
  463. $tekssh->disconnect( );
  464.  
  465. if ($tekssh_stat == 'ID1') {
  466. return 'ok_00001';
  467. }
  468.  
  469. return 'error_00007';
  470. }
  471. }
  472.  
  473. return 'error_00008';
  474. }
  475.  
  476. return $tekssh_stat;
  477. }
  478. ..............................................
  479. .............................
  480. ..............
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement