ç°¡åãªãšã³ã¿ãŒãã€ã¡ã³ããµãŒãã¹ãã£ãããããã1ã€äœæãããã¹ããŒãªãŒãã話ãããŸãã
ãšã³ããªãŒ
ç§ã«ã€ããŠïŒç§ã¯Habrãé·ãéïŒçŽ5幎ïŒèªãã§ããŸãããå®éã«å ±æãããã£ãã®ã§ã1ãæåã«ç»é²ããŸããã ç§ã¯ITäŒç€Ÿã§ãã¹ããšã³ãžãã¢ãšããŠåããŠããŸãã ããããç§ã¯åžžã«éçºã«é äºãããŸããã ãããŠçŽ7幎åãããªãŒã©ã³ã¹ã¯ã¡ã€ã³ã®ä»äºãšäžŠè¡ããŠåŸäºããŠããŸããã 圌ã¯ãå°ããªãã®ãã¹ãŠã®ããã«ãã°ãŒã°ã«ã®å©ããåããŠç解ãå§ããŸããã 圌ã¯ããããçš®é¡ã®ãŠã§ããããã€ãæžããã ããã¯ãã¹ãŠãç¹å®ã®è²¡åç®æšãéæããããã§ãã ãããŠç¢ºãã«ããã¹ãŠã®äººçã¯ãµã€ã¯ã«ã§æ§æãããŠããŸããïŒç®æšã®æ€çŽ¢-ããããæ段ã«ããéæ-æºè¶³-æ°ããç®æšã®æ€çŽ¢ã ã ããããªãŒã©ã³ã¹ã§ããã
転æç¹
2012/2013幎ã®å¬ã§ããã ç§ã¯ãªã³ã©ã€ã³ã³ã³ãµã«ã¿ã³ããããžã§ã¯ãã§ããªãŒã©ã³ã¹ã«åãçµãã§ãããjabberãšskypeãšã®çµ±åãè¡ãå¿ èŠããããŸãããã€ãŸãããªãã¬ãŒã¿ãŒãimã¯ã©ã€ã¢ã³ãã«å ¥åããããšã§ã¯ã©ã€ã¢ã³ããšé£æºãããµã€ããŠãŒã¶ãŒããã¹ãŠãWebã§ååŸã§ããããã«ããŸããã ã°ãŒã°ã«ã§æ€çŽ¢ããåŸãjabberã§ã¯ãã¹ãŠãã·ã³ãã«ã§ãããä»»æã®xmppãµãŒããŒïŒç§ã¯ejabberedãéžæããŸããïŒãšãããæäœããããã®ã©ã€ãã©ãªJAXLïŒgithubã§ãããåããŸããïŒããããŠããŒãžã§ã³2.xã§ããã ããããSkypeã«ã¯åé¡ããããŸãããéçºè ã»ã¯ã·ã§ã³ã®ãµã€ãã§ã¯ãäžéšã®ããããææã§æäŸããïŒãµãŒããŒã®äœ¿çšãçŠæ¢ããã©ã€ã»ã³ã¹ïŒãäžèŠãªã©ã€ã»ã³ã¹èªèšŒãè¡ãããäœããã®APIã«ã€ããŠèšåãããŠããŸããã ãããŠããã£ãšã·ã³ãã«ãªãã®ã欲ããã£ãã ãããŠã ã* nixã·ã¹ãã ã§PHPã䜿çšããŠSkype APIã«ã¢ã¯ã»ã¹ãããã§ãã®APIã«åºäŒããŸããããã¹ã«ã€ãWebãµã€ãã§APIãæäœããããšãžã®åç §ã¯ãããŸããããdbusçµç±ã§æäœããããã®PDFãããŠã³ããŒãããŸããã ç§ãæ¢ããŠãããã¹ãŠã®ãã®ããããŸããã
ã·ã¹ãã ãx64ã®å Žåãskypeã«ã¯ããã€ãã®x86äŸåé¢ä¿ãå¿ èŠã§ããããç§ãèªãã èšäºã«ã¯èšèŒãããŠããªãããã€ãã®åé¡ãäžåºŠã«ãããŸããã
sudo dpkg --add-architecture i386 sudo aptitude update
ãµãŒããŒåŽã§ã¡ãã»ãŒãžãåä¿¡ããïŒ
preg_match('#RECEIVED|SENT#Uis')
-ãã¹ãŠã®ã¡ãã»ãŒãžã«å¿çãããããæ£ããæ©èœããŸãã
-ãããŠãå®éã«ã¯ãã¡ãã»ãŒãžã®äžéšãdbusã®æ·±ãã§æ¶ããŠãphpããããã«å°éããªãããããã®ãããªæ§é ã䜿çšããªãã»ããè¯ãã§ããã€ãŸããã¹ã¯ãªããã¯å€ãã®å Žåããã¹ãŠã®ã¡ãã»ãŒãžãåä¿¡ã§ããªãããwhileïŒïŒãµã€ã¯ã«äžã«ã¡ãã»ãŒãžããŸã£ããåä¿¡ããŸããã è©Šè¡é¯èª€ã«ãã£ãŠããã¹ãŠã®ã¡ãã»ãŒãžã100ïŒ ãã£ããã£ããæ¹æ³ãèŠã€ãããŸãããã¹ã¯ãªãããã¢ã€ãã«ç¶æ ãŸãã¯ãªããŒããããåŸã§ãã次ã®ããã«ãªããŸãã
$oSkype->Invoke('SEARCH MISSEDMESSAGES')
詳现
class phpSkype { private static $iLastId; public static function notify($sNotify) { //.... //.... //.... /* Message serving 4 */ if (preg_match('/^CHATMESSAGES/', $sNotify)) { $sNotify = str_replace('CHATMESSAGES ', '', $sNotify); if ($sNotify != '') { $aMessages = explode(', ', $sNotify); if (sizeof($aMessages)) { foreach ($aMessages as $iMessageId) { $sAuthRaw = $oSkype->Invoke('GET CHATMESSAGE ' . $iMessageId . ' FROM_HANDLE'); $sMessageRaw = $oSkype->Invoke('GET CHATMESSAGE ' . $iMessageId . ' BODY'); $aMessage = explode('BODY ', $sMessageRaw); $aUsernameSkype = explode('FROM_HANDLE ', $sAuthRaw); $aChatHash = explode('CHATNAME ', $oSkype->Invoke('GET CHATMESSAGE ' . $iMessageId . ' CHATNAME')); verifyUserSkypeChatId($aUsernameSkype[1], $aChatHash[1]); if (self::$iLastId < $iMessageId) { self::$iLastId = $iMessageId; addLog($aUsernameSkype[1], $aMessage[1]); self::received($aUsernameSkype[1], trim(strtolower($aMessage[1])), $iMessageId); } else { $oSkype->Invoke('SET CHATMESSAGE ' . $iMessageId . ' SEEN'); } } } } } //.... //.... //.... } public static function received($sUid, $sMessage, $iLastMsgId) { $oSkype = Zend_Registry::get('$oSkype'); // Mark received message as read $oSkype->Invoke('SET CHATMESSAGE ' . $iLastMsgId . ' SEEN'); /* Prepare */ $sChatIdRaw = $oSkype->Invoke('GET CHATMESSAGE ' . $iLastMsgId . ' CHATNAME'); $aChatId = explode('CHATNAME ', $sChatIdRaw); $sMembers = $oSkype->Invoke("GET CHAT " . $aChatId[1] . " ACTIVEMEMBERS"); $sMembers = str_replace('CHAT ' . $aChatId[1] . ' ACTIVEMEMBERS ', '', $sMembers); $aMembers = explode(' ', $sMembers); if (sizeof($aMembers) > 2) { $oSkype->Invoke("ALTER CHAT " . $aChatId[1] . " CLEARRECENTMESSAGES"); $oSkype->Invoke("ALTER CHAT " . $aChatId[1] . " DISBAND"); $oSkype->Invoke("ALTER CHAT " . $aChatId[1] . " LEAVE"); return false; } //.... //.... //.... } } $oDbus->registerObject('/com/Skype/Client', 'com.Skype.API.Client', 'phpSkype'); $bSMLastUpdate = 0; while (true) { $s = $oDbus->waitLoop(1); /* Get new skype messages */ global $bSMLastUpdate; if (time() - $bSMLastUpdate >= $aConfig['skype_get_new_message']) { $bSMLastUpdate = time(); $oSkype->Invoke('SET USERSTATUS ONLINE'); $oSkype->Invoke('SEARCH MISSEDMESSAGES'); } }
dbusã§ã¯ãæªåŠçã®ã¡ãã»ãŒãžããã¹ãŠéä¿¡ããŸãïŒSEENãã©ã°ã¯ãããŸããïŒã
$oSkype->Invoke('SET CHATMESSAGE ' . $iMessageId . ' SEEN');
ãããŠã¡ã€ã³ã«ãŒãã§ãããããã£ããããŸãïŒ
preg_match('/^CHATMESSAGES/', $sNotify)
ããããŠãŒã¶ãŒããã®æ¿èªã«ã€ããŠãåãããšãè¡ãããŸãïŒå°æ¥ã®ãŠãŒã¶ãŒã¯ãã¹ã«ã€ãã§æ¿èªãéä¿¡ããã ãã§ç»é²ã§ããŸãïŒã
$oSkype->Invoke("SEARCH USERSWAITINGMYAUTHORIZATION")
åŸ ã€ã®ã§ã¯ãªãïŒ
preg_match('/^USER ([a-zA-Z0-9_\.]+) RECEIVEDAUTHREQUEST (.)+/', $sNotify, $aMatches)
ãããæã 倱ç«ããŸãã ãŠãŒã¶ãŒãé£çµ¡å ãªã¹ãããããããåé€ããããšãç¥ãå¿ èŠãããå Žåãå¥ã®ãã¥ã¢ã³ã¹ãããã«é¢é£ããŠããŸãã次ã«ãéå§ãããŸãã
/* Client unlink */ if (preg_match('/BUDDYSTATUS 2/', $sNotify)) { //... }
ãã ããããããããŠãŒã¶ãŒã«èªèšŒãéä¿¡ãããšãã«åæ§ã®åé¡ãçºçããå Žåã¯ã泚æããŠç¶æ³ãç£èŠããå¿ èŠããããŸãã
$oSkype->Invoke("SET USER [USER_NAME] BUDDYSTATUS 2 [AUTH_MESSAGE]");
ããããOSãŠãŒã¶ãŒãéã¢ã¯ãã£ãã«ãªã£ãåŸã«å°±å¯ãããšãã¹ã«ã€ããããããªããªããšããåé¡ã解決ã§ããŸããã§ããã ã¹ã«ã€ãèšå®ã§ã¯ãããã¯away_mode = offã§ããããã®è¡ã¯åœ¹ã«ç«ã¡ãŸããïŒ
$oSkype->Invoke('SET USERSTATUS ONLINE');
ãã®åŸã®ã¿ãã¹ã«ã€ãã¯å®å®ããŠåäœãå§ããŸããã
ãããŠãç§ã¯ãã¹ãŠã®éçºãšåãããã«ã9.xã®æç¹ã§freebsdã®ã»ããã¢ãããéå§ããŸãããããããã®ã·ã¹ãã ãæ°ã«å ¥ã£ãã®ã§ãé·ãéèŠåŽããŸããããdbusã§skypeãèµ·åããŸããã§ããããããŒãžã£ãŒãšdbusããã³ãããã®ççŸ
/root/.dbus/session-bus/ id dbus export DBUS_SESSION_BUS_ADDRESS=8c9916eb531f5f9a0458961c000033bc-1
Habrã®èšäºã§ç€ºãããŠããããã«ãç§ã¯åžžã«å©ãã«ã¯ãªããªãã£ãã®ã§ããã¹ãŠãLinuxã«ã€ã³ã¹ããŒã«ããªããã°ãªããŸããã§ãããç§ã¯debianãéžã³ãŸããã ããã¯ãšã³ãWebã¯freebsdã®ãŸãŸã§ãããmemcacheãä»ããŠäºãã«éä¿¡ããŠããŸããã ã¯ããã¯ããé«è²Žãªããã€ã¯ãã§ãããããã«ã€ããŠã¯ä»¥äžã§è©³ãã説æããŸãã
ãã£ãããããã³ãŒãã¯Webã³ãŒãã«é¢é£ä»ããããŠããã®ã§ãã§ããã ãæ©ããããäœæãããã£ãããã以åã¯äœ¿çšããããšããªããå®éã«ã¯ç解ããŠããªãã£ããã¡ãã»ãŒãžãã¥ãŒããé©åã«æ±ºå®ããã®ã§ã¯ãªããããžãã¯ã䜿çšããŠphp + memcacheããã¿ãŒã³ãäœæãå§ããŸããç»é²ãè¡ãããã®ããã¯ãããã³imãªãã¬ãŒã¿ãŒã®ã¯ã©ã€ã¢ã³ããžã®èªèšŒãšã¡ãã»ãŒãžã®éåæéä¿¡ã ããã¯ããªããç®ãã€ã¶ãããšãã§ããæããããæ©æ¢°ãã§ããããç§ãç¥ãéããããã¯æ©èœãããŸã æ©èœããŠããŸãã æ³åããŠã¿ãŠãã ããïŒãŠãŒã¶ãŒã®ããã/ OS 6åãDebianãŠãŒã¶ãŒããšã«6åã®ä»®æ³ãã¹ã¯ããããäžããvncãŠã£ã³ããŠ6åãããããã«4ã€ã®ã¹ã¯ãªããïŒskypeãšjabberããããçèšãã¥ãŒã®ã¯ãŒã«ãŒïŒããããŸãã ãµãŒããŒãåèµ·åãããã³ã«éªšã®æããäœæ¥ã«ãªãã6人ã®ãŠãŒã¶ãŒã§ã·ã¹ãã ã«ãã°ã€ã³ããããããã®vncãéããã¿ãŒããã«ãéããŠããã§4ã€ã®phpã¹ã¯ãªãããå®è¡ããŸããã VNCã䜿çšããŠãããšãã«ãããããæã å¥åŠãªãšã©ãŒãç¹ã«JAXLã§ã¯ã©ãã·ã¥ããŸããã
Interrupted system call jaxl_loop.php
åæåå Žæãnew JAXLïŒïŒãã®ãã£ãŒã«ããå€æŽ/åé€ããããšã§åŠçãããŸãããGoogleã§ã®éåžžã«å³ããæéå ã®æ€çŽ¢ã§ã¯ãæ éã«è§£æ±ºã§ããŸããã§ããã
æºåå®äºãå®å®
2013幎ã®æ¥ã«ãç§ã¯å®ç§äž»çŸ©ã楜ããããšæããã¢ã€ãã¢ã®é¢ã§é¢çœããŠå¿ èŠãªãã®ããã³ãŒãã®é¢ã§ã¯ãªãããã€ãã®ããã«çŸããæžãã¹ãã ãšèããŸããã ãããŠåœŒã¯ã¢ã€ãã¢ãæ¢ãå§ããŸããã ãããŠãçµå±ã®ãšããã圌女ã¯ç§ã®éŒ»ã®äžã«ããŸããã ããšãã°ãç§ã¯ããwindows7ãŸãã¯macosã§é»åãåŒã³åºããããæºåž¯é»è©±ã§å€©æ°ãç£èŠãããããŸãã ãããŠãã»ãŒäžæ¥äžãèµ·ããŠããéãç§ã¯ã³ã³ãã¥ãŒã¿ãŒã§éãããŸãã çµè«ã¯ããèªäœã§èŠæ±ãããŸãããé »ç¹ã«äœ¿çšãããæäœãåžžã«éããŠããã¢ããªã±ãŒã·ã§ã³ã«è»¢éããã³ã³ãã¥ãŒã¿ãŒäžã®æ¢åã®ã¿ã¹ã¯ã«å¯ŸããŠå®è¡ãããæäœã®æ°ãæžããå¿ èŠããããŸãã ãã³ãŽ ç§ã¯å¿ æ»ã«ã°ãŒã°ã«ã«ç»ããæ¢è£œã®ãœãªã¥ãŒã·ã§ã³ãããªãã¡äžè¬çãªIMãããã³ã«ãä»ããŠãã£ããããããšããŠå®è£ ãããããããçš®é¡ã®ã¢ããªã±ãŒã·ã§ã³ãæ¢ããŸããã ãã®ãšããç§ã¯1ã€ãèŠã€ããŸããã§ããïŒèŠãç®ãæªãã®ã§ããïŒïŒã ç¬èªã«äœæããå¿ èŠããããŸããããã¯ç¡æã§ãæãéèŠãªããšã¯èªåã§äœ¿çšããããšã§ãã USSDã³ãã³ãã䜿çšããŠãskypeãšjabberïŒåŸã§whatsappïŒãä»ããŠãŠãŒã¶ãŒãšããåãã§ãããããã®ãã£ãããäœæãã以åãããããæžããŠå®å šãªãœãªã¥ãŒã·ã§ã³ãäœæãããã¡ã€ã³åãããŽããŠã§ããµã€ãã®ãã¶ã€ã³ããµã€ãèªäœãéžæããå¿ èŠããããŸããæ®ãã¯ããã«å¿ èŠãªãã®ãã€ãŸããå®å šãªéçºãµã€ã¯ã«ãšè£œåã®å±éã§ãã
ã¿ã¹ã¯ã¯ç°¡åã§ã¯ãªããç§ã¯ä»¥åã«ããããã£ãããšããããŸããã§ããã ããããããªãã¯æåã®äžæ©ãèžã¿åºãå¿ èŠããããŸã.... ãããŠåœŒã¯ãã§ã«çµãã£ãŠããã æ£çŽã«èšããšããµãŒããŒãç£èŠãããµãŒããŒãç£èŠããããã«skype / jabber / whatsappã§ã³ã³ãœãŒã«sshãšãã¥ã¬ãŒã·ã§ã³ã䜿çšããã®ãããã«ã¯ãŒã«ããšããã«èããŸããïŒçŸæç¹ã§ã¯ããã®ã¿ã¹ã¯ã¯å®è£ ã延æãããŠããŸãããæ¢ã«ããã€ãã®éçºããããŸãïŒã
ãããŠãã10åéã®é»åã¡ãŒã«ããµãŒãã¹ã®é¡äŒŒç©ãæã«å ¥ããããšæã£ãŠããŸãããç§ã®äººæ°ã®ãããµãŒãã¹ã®ææè ã«ç§ã®ãã®ãžã®çµ±åã«ã€ããŠæžããŠãç§ã¯äœãè¯ãããšãæåŸ ããŠããŸããã§ãããç§ã®çŽæã¯å€±æããŸããã§ããããã®ã·ã¹ãã ã®éçºè ã¯ãµãŒãã¹ãç¡æã§ãããšäžå¯§ã«æåŠããéçºè ã¯ãããããŠåœŒãã«ããŒããŸããã®ãµãŒãã¹ã§åºåã«è²»ãããæéã ãããŠãç§ã¯ãããé »ç¹ã«äœ¿çšããŸãã ããŠããã®ãããã¯ã§ãã€ã¯ãããããå§ããŸããããä»ã®ãšãããŸã çµãã£ãŠããŸããããã®ãããè©Šè¡é¯èª€ãããã¢ã€ãã¢ããã¹ãŠãã°ããäœæããããšã¯ããŸãé©ããŠããŸããã
ããªãŒã©ã³ã¹ã§ã¯ããŸããããŸããã§ããïŒããããç§ã¯ããŸãåæºããŸããã§ããããã®ç®çã¯çµæžçã§ãããªãŒã©ã³ã¹ã¯ããã解決ããã®ã«åœ¹ç«ã¡ãŸãããä»ã®ç®æšã¯ãããŸããã§ãããããã¯ããç§ã¯ã¹ããŒããã€ã¯ã«ä¹ã£ãŠãä»ã§ã¯ç¢ºãã«ç®æšã¯ãããŸããã§ããïŒ ïŒç§ã¯ä»¥åã®ITäŒç€Ÿã§çµ¶ããåããŠããŸããããããèå³æ·±ããããžã§ã¯ãã§åããŠããŸããããããã§ãç§ãæ°ã«å ¥ã£ããã®ããã¯çšé ããã®ã§ããïŒã 2ãæéãã³ãŒããèŠãŸãããããšã«ãããã£ãããããã®ã³ã³ããã¹ãã§ã®phpã³ãŒãã®èŠ³ç¹ããã¯ãããçš®ã®æªç©ã§ããã ãããããµã€ãã®ãã¶ã€ã³ã¯ã»ãšãã©å€æŽãããã«æ®ã£ãŠãããããã«ãã©ããUIãäœæãå§ããŸããã圌ã«ãšã£ãŠãè¿ãå°æ¥æåããããã«æããŸããã æ¥ã®çµããã«ãç§ã¯ç°ãªãæ§è³ªã®å人çãªåé¡ãçµéšããŠããããã®ãµãŒãã¹ãå¿ããŠããã2013幎11æã«ãã®éçºã«æ»ããŸããæåã«è¡ãããšã¯ããã¹ãŠã®ãã£ãããããã³ãŒããåé€ããããšã§ãã ãããŠãmemcacheã®ãã¥ãŒãªãã§åã³æžã蟌ã¿ãéå§ããŸãã
ãŒããã
圌ã¯ãå°æ¥ã®ã¢ãŒããã¯ãã£ã®ããã¹ããã¢ãžã¥ãŒã«ïŒwebãapiãbotïŒã®æ§é ãæžããŸããã memcacheã®ã¹ãã¬ãŒãžæ§é ã«é¢ããããã¥ã¡ã³ãã®ã³ã³ãã€ã«-å°æ¥ã圌ã®ãã¡ã¢ãªãã¬ã¹ãã«å€§éã®ããžãã¯ãä¿æãããªãããã«ãããããã¹ãŠã倧ãã«åœ¹ç«ã¡ãŸããã
å§ãŸãã¯ç§ã®é ã®äžã«ãããŸããïŒ
Web ïŒ
freebsd 10 + php 5.x + apache + mysql 5.x + apc
ã 2çªç®ã®èªã¿åã
php 5.x nginx + php-fpm, apc, opcache.
Chatbot ïŒ
debian wheezy gnome + php 5.x + skype + memcache ( , ) + ejabbered JAXL 2.x ( 3.x)+ rabbitMQ ( ) PhpAmqpLib ( memcache github).
åã¢ããªã±ãŒã·ã§ã³ã®ã¢ãŒããã¯ãã£ïŒskypeã®ããããªã¹ããŒãjabberã®ããããªã¹ããŒãwhatsappã®ããããªã¹ããŒããŠãŒã¶ãŒã®è¿œå /åé€ãšãµãŒãã¹ã®è¿œå /åé€ãåŠçãããŠãŒã¶ãŒã¯ãŒã«ãŒïŒrabbitMQïŒãapi metdesãåŒã³åºãAPIã¯ãŒã«ãŒïŒrabbitMQïŒãã¡ãã»ãŒãžãéä¿¡ããã¹ãããŒã¯ãŒã«ãŒïŒrabbitMQïŒãš3ã€ã®ãã«ããŒïŒãã¹ãŠã®ãããã³ã«ïŒã¯ããŠãŒã¶ãŒã¯ãŒã«ãŒãšã¹ãããŒã¯ãŒã«ãŒããã³ãã³ããåä¿¡ããæãåçŽãªéä¿¡ãããã§ãããããã¯ã°ã©ãŠã³ãã§ãåŒã³åºãããäœæ¥åŸã«éãããããã¹ãŠã®ãããã¢ã¯ãã£ããã£ãçŽæ¥å®è£ ããŸãïŒæ¿èªãåãæ¶ããã¡ãã»ãŒãžãXãã§æ¿èªãéä¿¡ããã¡ãã»ãŒãžãéä¿¡ããŸãïŒã
ç§ãèŠããã¹ãããŠããéã«ãç§ã®ä»äºãèŠãä»äºã®ååãææ¡ããŸããïŒ
ããããã€ããŒïŒ
ãããŠãç§ã¯åã³äžå¯æ¬ ãªã¢ã·ã¹ã¿ã³ããã°ãŒã°ã«ã«ç®ãåããŸããã ãªãŒãã³APIã«ã€ããŠã¯äœããããŸããã§ããããwhatsappã䜿çšãããªãã·ã§ã³ãèŠã€ããŠãµãŒãã¹ã«åºå®ããŸããïŒgithubã§ã©ã€ãã©ãªã³ãŒããWhatsProtããååŸããŸããïŒã ãã ããwhatsappã¯äž»ã«éãã·ã¢èªè©±è åãã§ããããããããããã³ãµã€ãã§ç¿»èš³ãè¡ãå¿ èŠããããŸãã ããããããããžã§ã¯ããã©ã®èšèªã«ç¿»èš³ããŸããïŒããèªã¿ãè±èªããã·ã¢èªãç°¡äœåäžåœèªããã€ãèªãã¹ãã€ã³èªãéžæããäžåœèªãæåŠããŸããã
Webã®åºç€ãšããŠZF 2.xãæ¡çšããŸããã ãã¹ãŠã®ã¢ããªã±ãŒã·ã§ã³ãåäžã®ããããšããŠå®è£ ããåã¢ããªã±ãŒã·ã§ã³ãåå¥ã®ããããšããŠå®è£ ããããšãèšç»ããŸããã æåã®ã¹ããŒã ã¯éåžžã«äžå®å®ã§ããïŒãŸã ããã¥ã¡ã³ãåãããŠããªããã£ãã·ã¥ããã³ãã¡ãã»ãŒãžãã¥ãŒããšããŠmemcacheã«äŸåããŠããããïŒããããæåŠããŸããããéšåçã«è¿ãããŸããã 2ã€ç®ã¯ããã§ã«8ã€ã®ãããã®åŸãã¹ã«ã€ããšãžã£ããŒã§é£çµ¡å ãªã¹ããæ£ãããå§ãããŸããããŒã«ã«ã®ä»®æ³ãã·ã³äžã®ãªãœãŒã¹ãç¹ã«ã¹ã«ã€ãèªäœãä¿¡ããããªãé床ã§æ¶è²»ããŸããããããããšã«ããã¹ã¯ããããšã¹ã«ã€ãã§å¥ã ã®ãŠãŒã¶ãŒãå®è¡ããå¿ èŠããã£ãããã§ãïŒåãç°å¢ã§è€æ°ã®ç°ãªãã¹ã«ã€ããå®è¡ããããããã®APIã«id dbusã»ãã·ã§ã³ã§ãã€ã³ãããããšã¯å¯èœã§ããããŸã è©ŠããŠããŸããïŒããã®ã¹ããŒã ãæŸæ£ããåŸã§ããããçµã¿åãããŠãåããããã°ã«ãŒãåãããããã€ãã®ã¢ããªã±ãŒã·ã§ã³ãå®è£ ããŸã æèã ç§ã¯ãã®äžé£ã®ã¢ããªã±ãŒã·ã§ã³ããå§ããŸããã
- åºæ¬ïŒããŸããŸãªæäœãšãŠãŒã¶ãŒçµ±èšïŒ
- é»å
- 倩æ°
- ãããã€ã®å¡ãã®ä»çµã¿ãåããã²ãŒã ïŒãŸã ãªãªãŒã¹ããŠããŸãããã¯ããŒã«ããã«ASCIIãã©ããããã¢ãŒãã§æãæ¹æ³ãç解ããŠããªãããããã©ã³ãã¯ã¹ã«ã€ãã§ç§ãšã²ãŒã ããã¬ã€ããŸãïŒ
- ããžãã¯ããŒã«8
- å©çšå¯èœãª3ã€ã®ããããã®ã¯ã©ã€ã¢ã³ãããïŒç»é²ãããŠããªããŠãïŒã¡ãã»ãŒãžãïŒãããèªäœããã³èš±å¯ãªãWebãµã€ãããïŒãŠãŒã¶ãŒã«éä¿¡ããæ©èœ
- é貚ã¬ãŒã
- å€æç
- äžçã®ãœãŒã¹
- 欧å·äžå€®éè¡
- OCBC BankïŒã·ã³ã¬ããŒã«ïŒ
- ãã·ã¢äžå€®éè¡
- ãŠã¯ã©ã€ãåœç«éè¡
- ãã©ã«ãŒã·åœç«éè¡
- äžåœéè¡
- ã«ããéè¡
- ãããã³ã€ã³ã¬ãŒã
11æãš12æãš1æã«ãã»ãŒå®å®ããããŒãžã§ã³ãäœæããŸãããæãéèŠãªããšã¯ãå人ã®ãã¹ãã«é©ããããŒãžã§ã³ã§ãã
ãããããã®åŸã ãGoogleã¯XMPPã®ãµããŒããæŸæ£ããŠããŸãããšããèšäºã«åºäŒããå°ãè ¹ãç«ã¡ãŸãã ã ãããããã°ããããŠãèšäºããããã¯ãªãïŒ GoogleãXMPPã§è¡ã£ãããšã«ã€ã㊠'' ãç§ã¯ãã¹ãŠãããŸãããããšã«æ°ã¥ããç§ã¯åžžã«google xmppã䜿çšããŠããŸãã ãã¹ãã£ã³ã°ã«ãã¹ãŠã泚ããŸãã ç§ã®ãã¹ãVMã¯7ãããïŒåããã/ã¢ããªã±ãŒã·ã§ã³çšã®3ã€ã®ã¹ã¯ãªããïŒskype-jabber-whatsappïŒããã³åã¢ããªã±ãŒã·ã§ã³çšã®3ã€ã®ã¯ãŒã«ãŒïŒãŠãŒã¶ãŒã¯ãŒã«ãŒãAPIã¯ãŒã«ãŒïŒAPIãä»ããŠããŒã¿ããŒã¹ãšã®ãã¹ãŠã®ããåããèšè¿°ããŸãã-ãªããä»ãŸã§ïŒããããŸããããã¢ãžã¥ãŒã«åŒã§ããããŠã§ããšãããã®1ã€ã®ãšã³ããªãã€ã³ãã§ãã¹ãã容æã«ãªããŸããïŒãã¹ãã ã¯ãŒã«ãŒããã¹ãŠã®åŽåè ã¯éãŠãµã®MQãä»ããŠäœæ¥ããŸããïŒ3.5 GBã®RAMãæ¶è²»ãããã¹ãŠã®ãã¹ãã£ã³ã°äºæ¥è ã¯2 GBãš4 GBã®æéãæã¡ãŸãã4GBã®å Žåã¯2åã«ãªããŸãããããã¯ç§ã«ã¯åããŠããŸããã§ãããããã¯ãã¹ãŠæã«å ¥ããããµãŒãã¹ã¯ç¡æã§ããããããããžã¿ã«ãªãŒã·ã£ã³ãã«æžããŸãã ãã®ãµãŒãã¹ã®ããŒãºã®ãªã¯ãšã¹ãã«å¿ããªããã«HabréïŒã¯RAMã®ç°ãªãæ°ã®VMãäžããããšã§ããã匱ãããã»ããµãšãããã¯éèŠã§ã¯ãªãã£ãã§ãã 圌ãã¯ç§ãæåŠããŸããã æåŸ ã ãcomparevpsãã§ãã¹ãã£ã³ã°æ¥è ãæ¯èŒãã2GBãšåãéé¡ã§4GBã®ã·ã¹ãã ã䜿çšããŸãããããã®ãã¹ãã£ã³ã°æ¥è ãšã®ä»äºã®çµéšã¯äºæ³ãããããæªãããšãå€æããŸãããããã¹ãŠãéãããããŸãïŒæ®å¿µãªãããã®å ŽåïŒã ãããŠãè³Œå ¥ããVPSããã°ããå ¥æããããã«ãå®å šã«æ©èœãããµãŒãã¹ã®æ®µéã«freebsdãšdebianãµãŒããŒãã€ã³ã¹ããŒã«ããããã®2ã€ã®ã¹ããããã€ã¹ãããã®æé ãæžããŸããã
ãããã2å°ã®ãµãŒããŒïŒwebçšã®freebsd +ãã£ãããããçšã®debianïŒã䜿çšããã®ã¯äŸ¿å©ã§ã¯ãããŸããã§ããã ãããŠãããã¯debianã§ãããããã±ãŒãžããå¿ èŠãªãã®ã®ææ°ããŒãžã§ã³ããfreebsdã¢ã»ã³ããªãšããŒãã§ã©ãããã°ã§ããã®ããäžæå¿«ã«é©ããŸããã ãããããç¹ã«linuxãdebianã®å«æªè ã§ãªããªã£ãæ¹æ³ãšåå ãèŠã€ãåºããè¯ãæ¹æ³ã§çä¿¡è ã«ãªããŸããïŒä»ã§ã¯ "must have"ã« "Red Hat"ããããŸãïŒã
ç§ã¯åéã®å 端ã§æ°ããã¢ããªã±ãŒã·ã§ã³ãè¿œå ããŸããïŒ
- äžçæèšïŒãªãã»ãããæéãæ¥æ²¡ãæ¥ã®åºãã¿ã€ã ãŸãŒã³ïŒ
- ããã·ã¥ãžã§ãã¬ãŒã¿ãŒ
- HabraããŒãµãŒïŒãããã¯ç°¡åãªèª¬æãšãšãã«ãã®æ¥ã®æé«ã®èšäºãžã®ãã¹ãŠã®ãªã³ã¯ããã³ãããŸãïŒ
- ããã¹ã³ãŒãïŒé£æ床ã¯ããµããŒããããŠãããã¹ãŠã®èšèªã§ãå ã®ããã¹ã³ãŒããæ¢ãå¿ èŠãããããšã§ããããã®å Žã§ç¿»èš³ããã®ã¯æªãããšã§ãïŒ
11åã®ããããããã6åã®ã¹ã¯ãªããïŒ1çªç®ã®ã¹ã«ã€ãã2çªç®ã®ãžã£ããŒã3çªç®ã®whatsappã3人ã®ã¯ãŒã«ãŒïŒããšã«ãã·ã¹ãã ã«ã¯4 GBããããŸããã§ããã å ã«èšã£ãããã«ãã¢ããªã±ãŒã·ã§ã³ãããŒãå¥ã®ãããã«çµåããå¿ èŠãããããšãç解ããæãæ¥ãŸããã ããŒã¹ããªãã£ã¹ïŒé»åãçºæ¿ã¬ãŒããäžçæèšïŒãã©ã€ãã¹ã¿ã€ã«ïŒå€©æ°ãæå ãã8kaïŒãéçºè ïŒhabraãããã·ã¥ïŒãç»å ŽããŸããã çŸåšã¯2.5GBã§ååã§ãã ããããå°ãç²ããŠã ãJabberãå®å šãªæå·åã«åãæ¿ããŸããããã£ããèªãã§ãxmpp.netã§åœŒã®ãµãŒããŒããã¹ãããããšã決ããAã¬ãŒãã£ã³ã°ãåãåããŸããã ã¡ãªã¿ã«ãDNSã§ãããè¡ããŸã§ãé·ãéãjabberãããµãŒããŒã匷å¶çã«å ¬éããããšã¯ã§ããŸããã§ããïŒãŸãããµãŒããŒé察話ãè¿œå ããããšãã§ããŸããã§ããïŒã
ããããç§ã¯ãŸã jabberãŸãã¯ãµã€ãã®SSL蚌ææžãæã£ãŠããŸããã§ããã 60ãã«ã§2ã€ãç§ã¯ç¬ããã ãGet a free SSL certificateããšããèšäºãèŠã€ããŠãæ¥ãã§è¡ããŸããã ãã¹ãŠãã·ã³ãã«ã§æ確ã§ãã
ãã¹ãŠã®ãµãŒãã¹ãæåã§åŸ©å ããã®ã¯éåžžã«ããããããŠããŸããããã¹ããåå ã§ãµãŒããŒãã¯ã©ãã·ã¥ããããåèµ·ååŸã«ç©ºçœã®ãŸãŸã ã£ãå Žåã¯ãæææ¥ã«ã®ã¿èŠã€ããåé¡ãäœããã®æ¹æ³ã§è§£æ±ºããå¿ èŠããããŸããããã¯åææ¥ã«èµ·ãããŸããã ç§ã¯å€ãã®ç°ãªãããšãè©ŠããŸãããæçµçã«ãã·ã¹ãã ã¯åèµ·ååŸããã¹ãŠã®* nixãŠãŒã¶ãŒïŒskypeã®å ŽåïŒã«å®å šã«èªåçã«ãã°ã€ã³ãããã®äžã§ã°ã©ãã£ã«ã«ã·ã§ã«ã§ã¿ãŒããã«ãèµ·åãã6ã€ã®ã¿ããéããŠããããã«å¿ èŠãªphpã¹ã¯ãªãããèµ·åããŸããã€ã§ãåºåïŒãããã°ã®ããã«è»œåŸ®ãªåé¡ãçºçããããšããããŸãïŒïŒ
ãã¹ãŠã®ãŠãŒã¶ãŒã®Debianèªåãã°ã€ã³ãšã°ã©ãã£ã«ã«ã¢ãŒãã®ã¿ãŒããã«ã§ã®ã¹ã¯ãªããã®å®è¡
ãã¹ãªãŒããã¯ãã¹ã«ã€ããå«ããã¹ãŠãéå§ããããã«å¿ èŠã§ãã
ãŸããåãããã¹ã¯ãªãããå®è¡ããããã«èšèšãããåOSãŠãŒã¶ãŒã®gnomeèªåããŒãã§ã¯ãskypeããã³ãããã¡ã³ããã³ã¹ã¹ã¯ãªããã以äžã«è¿œå ããŸãã
ãããå šäœãåèµ·åããã«ã¯ã次ã䜿çšããŸãã
>>nano /etc/inittab 8:2345:respawn:/bin/login -f _ tty8 </dev/tty8 >/dev/tty8 2>&1 9:2345:respawn:/bin/login -f lifestyle tty9 </dev/tty9 >/dev/tty9 2>&1 10:2345:respawn:/bin/login -f developer tty10 </dev/tty10 >/dev/tty10 2>&1 11:2345:respawn:/bin/login -f xmess tty11 </dev/tty11 >/dev/tty11 2>&1 12:2345:respawn:/bin/login -f office tty12 </dev/tty12 >/dev/tty12 2>&1 >>nano /etc/profile sleep 8 [ `tty` == '/dev/tty8' ] && startx -- :1 sleep 8 [ `tty` == '/dev/tty9' ] && startx -- :2 sleep 8 [ `tty` == '/dev/tty10' ] && startx -- :3 sleep 8 [ `tty` == '/dev/tty11' ] && startx -- :4 sleep 8 [ `tty` == '/dev/tty12' ] && startx -- :5
ãã¹ãªãŒããã¯ãã¹ã«ã€ããå«ããã¹ãŠãéå§ããããã«å¿ èŠã§ãã
ãŸããåãããã¹ã¯ãªãããå®è¡ããããã«èšèšãããåOSãŠãŒã¶ãŒã®gnomeèªåããŒãã§ã¯ãskypeããã³ãããã¡ã³ããã³ã¹ã¹ã¯ãªããã以äžã«è¿œå ããŸãã
/home/USERNAME/.config/autostart/
[Desktop Entry] Type=Application Exec=skype Hidden=false X-GNOME-Autostart-enabled=true Name[en_US]=skype Name=skype Comment[en_US]= Comment=
[Desktop Entry] Type=Application Exec=gnome-terminal --tab --title="skype" -e "/usr/local/bin/php /home/_/utils/assistant/_skype_assistant/base_assistant.php" --tab --title="jabber" -e "/usr/local/bin/php /home/_/utils/assistant/_jabber_assistant/base_assistant.php" --tab --title="whatsapp" -e "/usr/local/bin/php /home/_/utils/assistant/_whatsapp_assistant/base_assistant.php" --tab --title="user_op" -e "/usr/local/bin/php /home/_/utils/assistant/lib/worker/user_operations_worker.php base_assistant" --tab --title="api" -e "/usr/local/bin/php /home/_/utils/assistant/lib/worker/api_worker.php base_assistant" --tab --title="spamer" -e "/usr/local/bin/php /home/_/utils/assistant/lib/worker/spamer_worker.php base_assistant" Hidden=false X-GNOME-Autostart-enabled=true Name[en_US]=all_tabs Name=all_tabs Comment[en_US]= Comment=
ãããå šäœãåèµ·åããã«ã¯ã次ã䜿çšããŸãã
killall -u lifestyle background /bin/login -f lifestyle tty9 </dev/tty9 >/dev/tty9 2>&1 &
ã·ã£ããããŠã³ãèµ·åäžã«ã¡ãŒã«ãåä¿¡ããããã«ã ãã®ã¹ã¯ãªããã䜿çšããŸããã ä»ã§ã¯ããµãŒããŒã§äœãèµ·ãã£ãŠããã®ããåžžã«ææ¡ããŠããããµãŒããŒãåç¬ã§å®å šã«äžæããé©ãããã£ãŠããã¹ãŠã®ããããæ©èœããããšãç¥ã£ãŠããŸããã ããã«ãããã¯ã¢ããbdãããŒããŒã·ã§ã³ã§èšå®ããã¡ãŒã«ã§ãã³ãããã³ãããŸãïŒãŸã å°ããã§ãïŒã
ããŒãããªãŒãã«ã€ããŠHabréã«ã€ããŠèªã¿ããããããã¹ãŠãšããŠããµãŒããŒããã§ãã¯ããŸãã-ãã¹ãŠã¯åé¡ãããŸããã§ããããTLS 1.2ããªã³ã«ããããšãã§ãããåžžã«FãååŸããŸãããåæã«ãããŸããŸãªãµãŒãã¹ããã¹ãããããã®ããŒãããªãŒãã®æªçšãçºèŠããŸãããç§ã¯ãããããŸããã§ãããã»ãã¥ãªãã£ãšã³ãžãã¢ãšããŠèªåèªèº«ãè©Šãã®ã¯é¢çœãã£ãã§ããåæã«ãnikto.plããè©Šãããnessusãã¹ãã£ããŒã«è§ŠçºãããŸããã ãããããã£ãããããã«æ»ã£ãŠãç§ã¯libsslãšãgãã§ããopensslãåé 眮ããnginxã®äŸåé¢ä¿ã確èªããå€ãlibãšãªã³ã¯ããŠããããšãåžžã«èŠãŠãwheezyã®ä»£ããã«nginxãsqueezeã«çœ®ãã ãã§ããã ãããnginxã«ãªã³ã¯ãããå€ãlibsslã®çç±ã§ãããããã®ããç§ã«ã¯è匱æ§ããããŸããã§ããã ãäºæ ããšããªãã¯èšããŸãã ãäºæ ã¯å¶ç¶ã§ã¯ãããŸããããšçããŸãã
ãšããã§ãwhatsappã®å Žåãç§ãç解ããŠããããã«ãã¢ã«ãŠã³ãããã®ãã¹ã¯ãŒãã®ç¡æåä¿¡ã¯ãã°ããããŠããéããããŸãããä»ã§ã¯éåžžã«ç°¡åã«ååŸã§ããŸãïŒ
whatsappã¢ã«ãŠã³ãã®ãã¹ã¯ãŒããååŸããŸã
ãããã
/* Request sms code */ $username = ""; $token = md5($username); $nickname = "__"; $w = new WhatsProt($username, $token, $nickname, true); $w->codeRequest();
ãããã
/* Get password */ $username = ""; $token = md5($username); echo $token; $nickname = "__"; $w = new WhatsProt($username, $token, $nickname, true); $result = $w->codeRegister("SMS___"); $password = $result->pw; echo "Password is $password";
ããããæ°ããæ¥ç¶ïŒç§ã®ã¹ããŒã ã§ã¯ã1ã€ã®ã¹ã¯ãªãããã³ãã³ãããªãã¹ã³ãããã1ã€ããã¥ãŒãä»ããŠåä¿¡ããå¿çãéä¿¡ããïŒãçŸåšã®æ¥ç¶ãäžæãããšããåé¡ããããŸãã whatsappããã¥ãŒãéšåçã«æŸæ£ããphpã¹ã¯ãªããèªäœã®èªååèµ·åãè¡ãå¿ èŠããããŸããã
ãŠãŒã¶ãŒãäœããæžãããšãã«ãã¿ã€ãã³ã°ãã¹ããŒã¿ã¹ã衚瀺ããããã®ãžã£ããŒãããã®èå³æ·±ããã³ãã次ã«ç€ºããŸãã
JAXLãããã®å
¥åã¹ããŒã¿ã¹
$oJabber->add_cb('on_chat_message', function($oStanza) { sMessage = trim(strtolower($oStanza->body)); if (!$sMessage) { $oStanza->to = $oStanza->from; $oStanza->from = $oJabber->full_jid->to_string(); $oJabber->send($oStanza); } //âŠ. }
, whatsapp skype , spamer , ,
posix_kill(getmypid(), 9);
jabber
$oJabber->send_end_stream();
:
- email 10
- im
- skype / jabber
, . , , ( ) .
, - , github. , , xml whatsapp «typing» , :
whatsapp get user message
$oWa->pollMessages(); $mData = $oWa->getMessages(); if (!empty($mData)) { if ('message' === $mData[count($mData) - 1]->getTag()) { if ('notify' === $mData[count($mData) - 1]->getChildren()[0]->getTag()) { $oDbAdapter->getConnection(); received($oWa->parseJID($mData[count($mData) - 1]->getAttributes()['from']), $mData[count($mData) - 1]->getChildren()[2]->getData());//$sUid, $sMessage $oDbAdapter->closeConnection(); } } }
: «» , , ! .
PS 1 : , « : » . , . , . , , .
: Free Object Motion Tracking Plugin at Final Cut Pro X, Adobe Premier and DaVinci Resolve.