PHP·þÎñÆ÷¶Ëͨ¹ýÃüÃû¹ÜµÀÓëC/C++³ÌÐòͨÐÅ
ÔÚÕ⼸ÌìµÄ¹¤×÷¹ý³ÌÖУ¬ÐèҪʵÏÖPHPÔÚ·þÎñÆ÷¶ËÄÜÓëÆäËû³ÌÐòͨÐÅ¡£ºÍÀϺÎÁ©ÈËÑо¿ÁË°ëÌ죬ÖÕÓÚ´óÖÂŪ³öÁËÒ»¸öÓÃWINDOWSµÄÃüÃû¹ÜµÀͨÐŵķ½·¨¡£
Óм¸µãÐèҪעÒâµÄ£º
PHP·þÎñÆ÷¶ËÎÒÃÇÿ´Î¶¼ÊÇÖØйҽÓÃüÃû¹ÜµÀ¡££¨ÕâÑùд£¬PHP¶Ë´úÂëÁ¿¼«ÆäÉÙ£¬¶øÇÒÒ²ºÜ·½±ã¡££©
ÄÇôÎÒÃÇÓÃC/C++дµÄÃüÃû¹ÜµÀ·þÎñÆ÷ÔòÐèҪÿ´ÎͨÐŶ¼´´½¨Ò»´Î¹ÜµÀ£¨·½·¨ºÜ¶ñÐÄ£¬µ«ÊÇÔÝʱÄÜʵÏÖ£¬¶øÇÒ¶ÔЧÂÊÒªÇó²»ÊÇÄÇô¸ß¡£ÎÒÃǾÍÕâôÓÃÁË¡££©
Èç¹û²»ÊÇÿ´Î¶¼´´½¨¹ÜµÀµÄ»°£¬»á³öÏÖ109´íÎó——Õâ¸öÎÊÌâÎÒÃǵ÷ÁËN¾Ã……
»¹ÓÐÒ»¸öʱÐòÎÊÌ⣬ÔڹܵÀSERVER¶Ëÿ´Î¹Ø±Õºó£¬ÐèÒªµÈPHP¶Ë´Ó¹ÜµÀÖÐÈ¡ÍêÊý¾Ý£¬ÔÙÖØд´½¨¹ÜµÀ¡££¨´Ë´¦ÎÒÃÇΪͼ·½±ã£¬ÔÝʱÓõÄsleep¡££©
ÏÂÃæ¸ø³öÀý×Ó£º
PHP¿Í»§¶Ë
function Pipe($msg)
{
$fp = @fopen("\\\\.\\pipe\\tongxun", 'w+r+b');
@fwrite($fp,$msg);//д
$result = @fread($fp,256);//¶Á
fclose($fp);
}
C++·þÎñÆ÷¶Ë
while(1)
{
// ´´½¨¹ÜµÀ·þÎñÆ÷
char strPipeName[] = "\\\\.\\pipe\\tongxun";
char szBuf[1024] = {0};
DWORD dwRead ;
DWORD userID;
char cmd;
PSECURITY_DESCRIPTOR psd;
psd = (PSECURITY_DESCRIPTOR) LocalAlloc(LPTR, SECURITY_DESCRIPTOR_MIN_LENGTH);
if (!InitializeSecurityDescriptor(psd, SECURITY_DESCRIPTOR_REVISION))
{
LocalFree((HLOCAL)psd);
return -1;
}
if (!SetSecurityDescriptorDacl(psd, TRUE, (PACL)NULL, FALSE))
{
LocalFree((HLOCAL)psd);
return -1;
}
SECURITY_ATTRIBUTES saAttr;
saAttr.nLength =sizeof(SECURITY_ATTRIBUTES);
saAttr.lpSecurityDescriptor = psd;
saAttr.bInheritHandle = TRUE;
HANDLE hIPC = CreateNamedPipe(strPipeName,
PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED,
PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT,
1, 0, 0, 1000, &saAttr);
if (hIPC == INVALID_HANDLE_VALUE)
{
return -1;
}
// Á¬½Ó¹ÜµÀ
ConnectNamedPipe(hIPC, NULL);
// ´Ó¹ÜµÀ¶ÁÈ¡ÐÅÏ¢
if (!ReadFile(hIPC, szBuf, sizeof(szBuf), &dwRead, 0))
{
break;
}
//´¦Àí¶Áµ½µÄÊý¾ÝszBuf...
....
//дÊý¾Ý...
//ÈçWriteFile(hIPC, msg, strlen(msg), &dwWrite, NULL)
CloseHandle(hIPC);
Sleep(100);
}
Ïà¹ØÎĵµ£º
Ì×½Ó×Ö±à³Ì£¬Ò»°ãʹÓÃc»òc++¡£ÌرðµÄÔÚwebÓ¦ÓóÌÐò¿ª·¢ÖУ¬³£ÓÃperlʵÏÖÌ×½Ó×Ö¡£³ý´ËÒÔÍ⣬ÓÃphp½øÐÐÌ×½Ó×Ö±à³ÌÒ²ÊÇÒ»¸öÑ¡Ôñ¡£Php¿ÉÒÔʤÈÎÂ𣿵±È»¿ÉÒÔ¡£PhpÊÇһßßÖÊÁ¿µÄwebÓ¦ÓóÌÐò¿ª·¢ÓïÑÔ£¬ËûµÄÐí¶àÌØÐÔ¿ÉÒÔ´¦ÀíÖÚ¶àµÄÈÎÎñ£¬ÍøÂç±à³ÌÒ²²»ÀýÍâ¡£
1. Àí½âÌ×½Ó×Ö
Mail¡¢ftp¡¢telnet¡¢nameºÍfingerÕ ......
ÔÚwindowsÏ°²×°ampÍøÉϵĽéÉܺܶàÁË¡£
ÎÒÕâÀïֻ˵Щ¹Ø¼üµÄ²¿·Ö£¬Ò»·½Ãæ×÷Ϊ±Ê¼Ç£¬ÁíÒ»·½ÃæºÍ´ó¼Ò¹²Ïí¡£
1.°²×°apache
a.ÕâÀïҪעÒ⣬ÔÚ¸Õ¿ªÊ¼ÌîдÖ÷»úÓòÃûʱ£¬Èç¹ûÄãûÓÐÓòÃû£¬¾ÍÔÚ±¾µØ°²×°£¬ÄǾÍÌîд±¾»úipÐÐÁË¡££¨ÎÒ¾õµÃÌîд127.0.0.1¸üºÃ£¬¾ßÌåÎÒûÊÔ¹ý£©
b.apache µÄĬÈ϶˿ÚÊÇ80£¬ÎÒµÄ ......
/* find files from wildcards, for MicroSoft C v4.0 */
/* ------------------------------------------------------------ */
/* copyright 1986: */
/* Nourse Gregg & Browne, Inc. */
/* 1 Horizon Road. #612 ......
1£®¸ÅÄî
ÔÚC/C++ÖУ¬¶Ô×Ö·û´®µÄ²Ù×÷ÓкܶàÖµµÃ×¢ÒâµÄÎÊÌ⣬ͬÑù£¬C/C++¶Ôʱ¼äµÄ²Ù×÷Ò²ÓÐÐí¶àÖµµÃ´ó¼Ò×¢ÒâµÄµØ·½¡£×î½ü£¬ÔÚ¼¼ÊõȺÖÐÓкܶàÍøÓÑÒ²¶à´ÎÎʵ½¹ýC++ÓïÑÔÖжÔʱ¼äµÄ²Ù×÷¡¢»ñÈ¡ºÍÏÔʾµÈµÈµÄÎÊÌâ¡£ÏÂÃ棬ÔÚÕâƪÎÄÕÂÖУ¬±ÊÕß½«Ö÷Òª½éÉÜÔÚC/C++ÖÐʱ¼äºÍÈÕÆÚµÄʹÓ÷½·¨. ......