{"id":282736,"date":"2016-12-20T09:20:03","date_gmt":"2016-12-20T06:20:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=282736"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=282736","title":{"rendered":"\u0411\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u043a\u0430 \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 GSM-\u0448\u043b\u044e\u0437"},"content":{"rendered":"<p>\u0412 \u043d\u0430\u0448\u0435\u0439 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0410\u0441\u0442\u0435\u0440\u0438\u0441\u043a, \u0430 \u0434\u043b\u044f \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u043a \u043d\u0435\u043c\u0443 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d GSM-\u0448\u043b\u044e\u0437 Yeastar TG800 \u043d\u0430 8 \u0441\u0438\u043c\u043e\u043a.<\/p>\n<p>  \u041a\u0430\u0436\u0434\u044b\u0439 \u043c\u0435\u0441\u044f\u0446 \u043c\u044b \u043f\u043e\u043a\u0443\u043f\u0430\u0435\u043c \u043f\u0430\u043a\u0435\u0442 \u043c\u0438\u043d\u0443\u0442 \u043d\u0430 \u043a\u0430\u0436\u0434\u0443\u044e \u0441\u0438\u043c\u043a\u0443.<\/p>\n<p>  \u0414\u043b\u044f \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 \u043e\u0431\u044b\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0431\u043e\u0440 \u0441\u0438\u043c\u043e\u043a \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443, \u043f\u043e\u043a\u0430 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u0442\u0441\u044f \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u0430\u044f:<\/p>\n<p>  exten =&gt; _X.,n,Dial(SIP\/gsm1\/${EXTEN},,tT)<br \/>  exten =&gt; _X.,n,Dial(SIP\/gsm2\/${EXTEN},,tT)<br \/>  exten =&gt; _X.,n,Dial(SIP\/gsm3\/${EXTEN},,tT)<br \/>  \u0438 \u0442. \u0434.<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0447\u0435\u0440\u0435\u0437 \u043f\u0435\u0440\u0432\u0443\u044e \u0441\u0438\u043c\u043a\u0443, \u0430 \u043c\u0435\u043d\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0447\u0435\u0440\u0435\u0437 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043a \u0441\u0435\u0440\u0435\u0434\u0438\u043d\u0435 \u043c\u0435\u0441\u044f\u0446\u0430 \u043c\u0438\u043d\u0443\u0442\u044b \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0445 \u0441\u0438\u043c\u043a\u0430\u0445 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0440\u0430\u043d\u044c\u0448\u0435, \u0447\u0435\u043c \u043d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445, \u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f, \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u0437\u0432\u043e\u043d\u0438\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0447\u0435\u0440\u0435\u0437 4 \u0441\u0438\u043c\u043a\u0438 \u0438\u0437 8, \u0442\u0430\u043a \u043a\u0430\u043a \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0445 \u0447\u0435\u0442\u044b\u0440\u0435\u0445 \u043c\u0438\u043d\u0443\u0442\u044b \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0438\u0441\u044c. \u042d\u0442\u043e \u043f\u043b\u043e\u0445\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f 4 \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u043b\u0438\u043d\u0438\u0438 \u0432\u043c\u0435\u0441\u0442\u043e 8.<\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u044d\u0442\u043e\u0433\u043e \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c, \u043d\u0443\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0437\u043e\u0432\u044b \u043d\u0435 \u0432 \u043e\u0434\u043d\u043e\u043c \u0438 \u0442\u043e\u043c \u0436\u0435 \u043f\u043e\u0440\u044f\u0434\u043a\u0435, \u0430 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u043e\u0441\u0442\u0430\u0442\u043a\u043e\u043c \u043c\u0438\u043d\u0443\u0442 \u043d\u0430 \u0441\u0438\u043c\u043a\u0430\u0445.<br \/>  <a name=\"habracut\"><\/a><\/p>\n<p>  \u041f\u043e\u043f\u0443\u0442\u043d\u043e \u044f \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u044e \u043e\u0441\u0442\u0430\u0442\u043a\u0438 \u043c\u0438\u043d\u0443\u0442, \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c (\u0432\u043e \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u044b\u043b\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u044b \u043e\u0441\u0442\u0430\u0442\u043a\u0438) \u0438 \u043a\u043e\u0433\u0434\u0430 \u043f\u0430\u043a\u0435\u0442 \u0431\u044b\u043b \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043d \u0432 \u0411\u0414 MySQL.<\/p>\n<p>  \u041c\u043e\u0436\u043d\u043e \u0437\u0430\u0439\u0442\u0438 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043a\u0443 \u0438 \u0431\u044b\u0441\u0442\u0440\u043e \u0443\u0437\u043d\u0430\u0442\u044c \u043e\u0441\u0442\u0430\u0442\u043a\u0438:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/1b7\/dfa\/edf\/1b7dfaedfb534ec9bdb07043fa0b477d.PNG\" alt=\"image\"\/><\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043e\u0441\u0442\u0430\u0442\u043a\u0438, \u043d\u0443\u0436\u043d\u043e \u043d\u0430 \u0448\u043b\u044e\u0437\u0435 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c API, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u0445\u043e\u0434\u0438\u043c \u0432 \u0440\u0430\u0437\u0434\u0435\u043b SMS, \u0434\u0430\u043b\u0435\u0435 \u0432 API-\u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438. \u0422\u0430\u043c \u0432\u0441\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u043b\u043e\u0433\u0438\u043d \u0441 \u043f\u0430\u0440\u043e\u043b\u0435\u043c \u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043d\u0443\u044e \u043f\u043e\u0434\u0441\u0435\u0442\u044c \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f.<\/p>\n<p>  \u0411\u0443\u0434\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043e\u0441\u0442\u0430\u0442\u043a\u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u0447\u0430\u0441, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u043a\u0440\u043e\u043d \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432\u044b\u0437\u043e\u0432 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 (\u0443 \u043c\u0435\u043d\u044f \u043a\u0430\u0436\u0434\u0443\u044e 53-\u044e \u043c\u0438\u043d\u0443\u0442\u0443 \u0447\u0430\u0441\u0430):<br \/>  53 *\/1 * * * root php %path-to-script%\/getbalance.php<\/p>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c 8 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 (\u0438\u043b\u0438 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443 \u0432\u0430\u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u0438\u043c\u043e\u043a) \u0441 \u0438\u043c\u0435\u043d\u0430\u043c\u0438 \u043e\u0442 nc2.txt \u0434\u043e nc9.txt. \u041d\u043e\u043c\u0435\u0440\u0430 \u0442\u0430\u043a\u0438\u0435, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0448\u043b\u044e\u0437 \u043d\u0443\u043c\u0435\u0440\u0443\u0435\u0442 \u0441\u0432\u043e\u0438 \u043f\u043e\u0440\u0442\u044b \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a, \u043e\u0442 2 \u0434\u043e 9.<\/p>\n<p>  \u0412 \u043a\u0430\u0436\u0434\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0448\u043b\u044e\u0437\u0443. \u041f\u0440\u0438\u043c\u0435\u0440 \u0434\u043b\u044f nc2.txt:<br \/>  action: login<br \/>  username: ******<br \/>  secret: *******<\/p>\n<p>  action: smscommand<br \/>  command: gsm send ussd 2 *255*0#<\/p>\n<p>  action: logoff<\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u0434\u043b\u044f \u0422\u0435\u043b\u04352.<\/p>\n<p>  \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432 \u0444\u0430\u0439\u043b\u0435 nc3.txt \u0432\u043c\u0435\u0441\u0442\u043e \u00abussd 2\u00bb \u043f\u0438\u0448\u0435\u043c \u00abussd 3\u00bb.<\/p>\n<p>  \u0421\u043a\u0440\u0438\u043f\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u044d\u0442\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0448\u043b\u044e\u0437\u0443, \u0432 \u043e\u0442\u0432\u0435\u0442 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0444\u0430\u0439\u043b\u044b \u0441 \u0438\u043c\u0435\u043d\u0430\u043c\u0438 \u043e\u0442 nc2out.txt \u0434\u043e nc9out.txt.<\/p>\n<p>  \u041e\u0442\u0432\u0435\u0442 \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a\u043e\u0439 (\u0434\u043b\u044f \u0422\u0435\u043b\u04352):<br \/>  Asterisk Call Manager\/1.1<br \/>  Response: Success<br \/>  Message: Authentication accepted<\/p>\n<p>  Response: Follows<br \/>  Privilege: SMSCommand<br \/>  1:Received USSD success on span: 2<br \/>   USSD Responses: 2<br \/>   USSD Code: 64<br \/>   USSD Len: 85<br \/>   USSD Message: Ostatok v pakete: 968 min.\/mes., 5000 SMS\/mes., 20480 MB\/mes. Parametry&#8217; tarifa *107#<br \/>  &#8212;END COMMAND&#8212;<\/p>\n<p>  Response: Goodbye<br \/>  Message: Thanks for all the fish.<\/p>\n<p>  \u0423\u0442\u043e\u0447\u043d\u0435\u043d\u0438\u0435: \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043e\u0442\u0432\u0435\u0442\u044b \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u043d\u0430 \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0442, \u0438\u043d\u0430\u0447\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u0435\u043a\u0441\u0442 \u0432 \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e\u0439 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0435.<\/p>\n<p>  \u0414\u0430\u043b\u044c\u0448\u0435 \u043c\u044b \u0432\u044b\u0434\u0435\u0440\u0433\u0438\u0432\u0430\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0445\u0441\u044f \u043c\u0438\u043d\u0443\u0442, \u0441\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0432\u044b\u0437\u043e\u0432\u0430 \u0432 \u0444\u0430\u0439\u043b\u044b \u043e\u0442 out1.txt \u0434\u043e out8.txt (\u044d\u0442\u043e \u0443\u0436\u0435 \u0434\u043b\u044f \u0430\u0441\u0442\u0435\u0440\u0438\u0441\u043a\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0443\u043c\u0435\u0440\u0430\u0446\u0438\u044f \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u0430\u044f). \u0422\u043e \u0435\u0441\u0442\u044c \u0435\u0441\u043b\u0438 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0432\u044b\u0437\u043e\u0432\u0430 \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f 5, 4, 3, 2, 1, 7, 8, 6, \u0442\u043e \u0432 \u0444\u0430\u0439\u043b out1.txt \u043c\u044b \u043f\u0438\u0448\u0435\u043c \u0446\u0438\u0444\u0440\u0443 5, \u0432 \u0444\u0430\u0439\u043b out2.txt \u043f\u0438\u0448\u0435\u043c 4 \u0438 \u0442. \u0434.<\/p>\n<p>  \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0432 \u0434\u0438\u0430\u043b\u043f\u043b\u0430\u043d\u0435 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u044d\u0442\u0438 \u0444\u0430\u0439\u043b\u044b \u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0437\u043e\u0432\u044b \u0432 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435:<\/p>\n<p>  exten =&gt; _X.,n,set(SIMNUM1=${SHELL(\/usr\/bin\/php -f %pathtoscript%\/getsim1.php)})<br \/>  exten =&gt; _X.,n,set(SIMNUM2=${SHELL(\/usr\/bin\/php -f %pathtoscript%\/getsim2.php)})<br \/>  exten =&gt; _X.,n,set(SIMNUM3=${SHELL(\/usr\/bin\/php -f %pathtoscript%\/getsim3.php)})<br \/>  exten =&gt; _X.,n,set(SIMNUM4=${SHELL(\/usr\/bin\/php -f %pathtoscript%\/getsim4.php)})<br \/>  exten =&gt; _X.,n,set(SIMNUM5=${SHELL(\/usr\/bin\/php -f %pathtoscript%\/getsim5.php)})<br \/>  exten =&gt; _X.,n,set(SIMNUM6=${SHELL(\/usr\/bin\/php -f %pathtoscript%\/getsim6.php)})<br \/>  exten =&gt; _X.,n,set(SIMNUM7=${SHELL(\/usr\/bin\/php -f %pathtoscript%\/getsim7.php)})<br \/>  exten =&gt; _X.,n,set(SIMNUM8=${SHELL(\/usr\/bin\/php -f %pathtoscript%\/getsim8.php)})<\/p>\n<p>  exten =&gt; _X.,n,Dial(SIP\/gsm${SIMNUM1}\/${EXTEN},,tT)<br \/>  exten =&gt; _X.,n,Dial(SIP\/gsm${SIMNUM2}\/${EXTEN},,tT)<br \/>  exten =&gt; _X.,n,Dial(SIP\/gsm${SIMNUM3}\/${EXTEN},,tT)<br \/>  exten =&gt; _X.,n,Dial(SIP\/gsm${SIMNUM4}\/${EXTEN},,tT)<br \/>  exten =&gt; _X.,n,Dial(SIP\/gsm${SIMNUM5}\/${EXTEN},,tT)<br \/>  exten =&gt; _X.,n,Dial(SIP\/gsm${SIMNUM6}\/${EXTEN},,tT)<br \/>  exten =&gt; _X.,n,Dial(SIP\/gsm${SIMNUM7}\/${EXTEN},,tT)<br \/>  exten =&gt; _X.,n,Dial(SIP\/gsm${SIMNUM8}\/${EXTEN},,tT)<\/p>\n<p>  \u0414\u0430, \u0447\u0443\u0442\u044c \u043d\u0435 \u0437\u0430\u0431\u044b\u043b, \u0444\u0430\u0439\u043b getsim1.php:<br \/>  &lt;?php<br \/>  $t = file_get_contents(&#8216;%pathtoscript%\/out1.txt&#8217;);<br \/>  echo $t[0];<br \/>  return $t[0];<br \/>  ?&gt;<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441\u0430\u043c \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 getbalance.php.<\/p>\n<p>  IP \u0448\u043b\u044e\u0437\u0430 \u0432\u043e\u0437\u044c\u043c\u0435\u043c 10.10.1.1.<\/p>\n<p>  \u0417\u043d\u0430\u044e, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0446\u0438\u043a\u043b \u0432\u043c\u0435\u0441\u0442\u043e \u043a\u043e\u043f\u0438\u043f\u0430\u0441\u0442\u044b, \u043d\u043e \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0443\u044e\u0441\u044c \u0437\u043e\u043b\u043e\u0442\u044b\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u043e\u043c \u0430\u0434\u043c\u0438\u043d\u0430: \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u2014 \u043d\u0435 \u0442\u0440\u043e\u0433\u0430\u0439 \ud83d\ude42<\/p>\n<pre><code class=\"php\">&lt;?php include '\/var\/lib\/asterisk\/agi-bin\/lib.php';  $s=0; a2: $s++; if ($s&gt;10) exit; system('nc 10.10.1.1 5038 &lt; %pathtoscript%\/nc2.txt &gt; %pathtoscript%\/nc2out.txt'); $text = file_get_contents('%pathtoscript%\/nc2out.txt'); if(preg_match('\/te:\\ (.*)\\ min\/',$text,$matches)) $text2 = $matches[1]; else goto a2;  $s=0; a3: $s++; if ($s&gt;10) exit; system('nc 10.10.1.1 5038 &lt; %pathtoscript%\/nc3.txt &gt; %pathtoscript%\/nc3out.txt'); $text = file_get_contents('%pathtoscript%\/nc3out.txt'); if(preg_match('\/te:\\ (.*)\\ min\/',$text,$matches)) $text3 = $matches[1]; else goto a3;  $s=0; a4: $s++; if ($s&gt;10) exit; system('nc 10.10.1.1 5038 &lt; %pathtoscript%\/nc4.txt &gt; %pathtoscript%\/nc4out.txt'); $text = file_get_contents('%pathtoscript%\/nc4out.txt'); if(preg_match('\/te:\\ (.*)\\ min\/',$text,$matches)) $text4 = $matches[1]; else goto a4;  $s=0; a5: $s++; if ($s&gt;10) exit; system('nc 10.10.1.1 5038 &lt; %pathtoscript%\/nc5.txt &gt; %pathtoscript%\/nc5out.txt'); $text = file_get_contents('%pathtoscript%\/nc5out.txt'); if(preg_match('\/te:\\ (.*)\\ min\/',$text,$matches)) $text5 = $matches[1]; else goto a5;  $s=0; a6: $s++; if ($s&gt;10) exit; system('nc 10.10.1.1 5038 &lt; %pathtoscript%\/nc6.txt &gt; %pathtoscript%\/nc6out.txt'); $text = file_get_contents('%pathtoscript%\/nc6out.txt'); if(preg_match('\/te:\\ (.*)\\ min\/',$text,$matches)) $text6 = $matches[1]; else goto a6;  $s=0; a7: $s++; if ($s&gt;10) exit; system('nc 10.10.1.1 5038 &lt; %pathtoscript%\/nc7.txt &gt; %pathtoscript%\/nc7out.txt'); $text = file_get_contents('%pathtoscript%\/nc7out.txt'); if(preg_match('\/te:\\ (.*)\\ min\/',$text,$matches)) $text7 = $matches[1]; else goto a7;  $s=0; a8: $s++; if ($s&gt;10) exit; system('nc 10.10.1.1 5038 &lt; %pathtoscript%\/nc8.txt &gt; %pathtoscript%\/nc8out.txt'); $text = file_get_contents('%pathtoscript%\/nc8out.txt'); if(preg_match('\/te:\\ (.*)\\ min\/',$text,$matches)) $text8 = $matches[1]; else goto a8;  $s=0; a9: $s++; if ($s&gt;10) exit; system('nc 10.10.1.1 5038 &lt; %pathtoscript%\/nc9.txt &gt; %pathtoscript%\/nc9out.txt'); $text = file_get_contents('%pathtoscript%\/nc9out.txt'); if(preg_match('\/te:\\ (.*)\\ min\/',$text,$matches)) $text9 = $matches[1]; else goto a9;  $text10 = &quot;0&quot;;  system('echo &quot;'.date('l dS F Y h:i:s A').' '.$text2.' '.$text3.' '.$text4.' '.$text5.' '.$text6.' '.$text7.' '.$text8.' '.$text9.'&quot; &gt;&gt;%pathtoscript%\/balance.txt');  $row = mysql_query(&quot;select minutes from `lines` where clid like '%2636'&quot;,$link); $row1 = mysql_fetch_assoc($row); $old1 = $row1['minutes']+0; $new1 = $text2+0;  if ($old1 &lt; $new1) $row = mysql_query(&quot;update `lines` set balancedate=NOW()&quot;,$link);  $row = mysql_query(&quot;update `lines` set balance=&quot;.$text10.&quot;, minutesdate=NOW(), minutes=&quot;.$text2.&quot; where clid like '%2636'&quot;,$link); $row = mysql_query(&quot;update `lines` set balance=&quot;.$text10.&quot;, minutesdate=NOW(), minutes=&quot;.$text3.&quot; where clid like '%4036'&quot;,$link); $row = mysql_query(&quot;update `lines` set balance=&quot;.$text10.&quot;, minutesdate=NOW(), minutes=&quot;.$text4.&quot; where clid like '%4977'&quot;,$link); $row = mysql_query(&quot;update `lines` set balance=&quot;.$text10.&quot;, minutesdate=NOW(), minutes=&quot;.$text5.&quot; where clid like '%2414'&quot;,$link); $row = mysql_query(&quot;update `lines` set balance=&quot;.$text10.&quot;, minutesdate=NOW(), minutes=&quot;.$text6.&quot; where clid like '%2451'&quot;,$link); $row = mysql_query(&quot;update `lines` set balance=&quot;.$text10.&quot;, minutesdate=NOW(), minutes=&quot;.$text7.&quot; where clid like '%2536'&quot;,$link); $row = mysql_query(&quot;update `lines` set balance=&quot;.$text10.&quot;, minutesdate=NOW(), minutes=&quot;.$text8.&quot; where clid like '%2581'&quot;,$link); $row = mysql_query(&quot;update `lines` set balance=&quot;.$text10.&quot;, minutesdate=NOW(), minutes=&quot;.$text9.&quot; where clid like '%4056'&quot;,$link);  $n[1] = $text2+0; $n[2] = $text3+0; $n[3] = $text4+0; $n[4] = $text5+0; $n[5] = $text6+0; $n[6] = $text7+0; $n[7] = $text8+0; $n[8] = $text9+0;  $p[1] = 1; $p[2] = 2; $p[3] = 3; $p[4] = 4; $p[5] = 5; $p[6] = 6; $p[7] = 7; $p[8] = 8;  for($i=1;$i&lt;=7;$i++) for($j=$i+1;$j&lt;=8;$j++) if ($n[$i]&lt;$n[$j]) { $t = $n[$i]; $n[$i] = $n[$j]; $n[$j] = $t;  $t = $p[$i]; $p[$i] = $p[$j]; $p[$j] = $t; }  system('echo &quot;'.$p[1].'&quot; &gt;%pathtoscript%\/out1.txt'); system('echo &quot;'.$p[2].'&quot; &gt;%pathtoscript%\/out2.txt'); system('echo &quot;'.$p[3].'&quot; &gt;%pathtoscript%\/out3.txt'); system('echo &quot;'.$p[4].'&quot; &gt;%pathtoscript%\/out4.txt'); system('echo &quot;'.$p[5].'&quot; &gt;%pathtoscript%\/out5.txt'); system('echo &quot;'.$p[6].'&quot; &gt;%pathtoscript%\/out6.txt'); system('echo &quot;'.$p[7].'&quot; &gt;%pathtoscript%\/out7.txt'); system('echo &quot;'.$p[8].'&quot; &gt;%pathtoscript%\/out8.txt');  system('asterisk -rx &quot;dialplan reload&quot;'); ?&gt; <\/code><\/pre>\n<p>  \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 lib.php (\u0442\u0430\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a MySQL):  <\/p>\n<pre><code class=\"php\">&lt;?php  $dbuser = &quot;*******&quot;; $dbpass = &quot;*******&quot;; $dbserv = &quot;localhost&quot;; $dbname = &quot;*******&quot;;  $dbengn = &quot;mysql&quot;;  function sql_connect($host, $login, $password, $dbname) {     $link = mysql_connect($host, $login, $password, true);     mysql_select_db($dbname, $link);     mysql_query(&quot;SET NAMES cp1251&quot;);     return $link; }  function sql_query($query, $link)  {  $res = mysql_query($query, $link);  return $res; }  function sql_fetch_assoc($result)  {     return mysql_fetch_assoc($result);  }  $link = sql_connect($dbserv, $dbuser, $dbpass, $dbname); ?&gt; <\/code><\/pre>\n<p>  \u0415\u0449\u0435 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u043f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u044f.<\/p>\n<p>  \u041d\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0438\u043c\u043a\u0435 \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f 10 \u043f\u043e\u043f\u044b\u0442\u043e\u043a \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0431\u0430\u043b\u0430\u043d\u0441 (\u044d\u0442\u043e \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0443\u0434\u0430\u0435\u0442\u0441\u044f), \u0435\u0441\u043b\u0438 \u0445\u043e\u0442\u044f \u0431\u044b \u043d\u0430 \u043e\u0434\u043d\u043e\u0439 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c, \u0432\u044b\u0445\u043e\u0434\u0438\u043c \u0438 \u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0447\u0435\u0440\u0435\u0437 \u0447\u0430\u0441.<\/p>\n<p>  \u041f\u043e\u0447\u0435\u043c\u0443 text10=\u00ab0\u00bb? \u0420\u0430\u043d\u044c\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u0441\u0438\u043c\u043a\u0438 \u041c\u0422\u0421, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b\u0438 \u0431\u0430\u043b\u0430\u043d\u0441 (\u0432 \u0440\u0443\u0431\u043b\u044f\u0445). \u0412 \u0422\u0435\u043b\u04352 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043e\u0431\u0449\u0438\u0439 \u0441\u0447\u0435\u0442, \u043d\u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u0441\u0438\u043c\u043a\u0438 \u043c\u044b \u0434\u0435\u043d\u0435\u0433 \u043d\u0435 \u043a\u043b\u0430\u0434\u0435\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0442\u0430\u043c \u0432\u0441\u0435\u0433\u0434\u0430 0.<\/p>\n<p>  \u0411\u0430\u043b\u0430\u043d\u0441\u044b \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u0444\u0430\u0439\u043b balance.txt, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u0438 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 \u0442\u0440\u0430\u0442.<\/p>\n<p>  \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435!<br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habrahabr.ru\/post\/318004\/\"> https:\/\/habrahabr.ru\/post\/318004\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0412 \u043d\u0430\u0448\u0435\u0439 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0410\u0441\u0442\u0435\u0440\u0438\u0441\u043a, \u0430 \u0434\u043b\u044f \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u043a \u043d\u0435\u043c\u0443 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d GSM-\u0448\u043b\u044e\u0437 Yeastar TG800 \u043d\u0430 8 \u0441\u0438\u043c\u043e\u043a.<\/p>\n<p>  \u041a\u0430\u0436\u0434\u044b\u0439 \u043c\u0435\u0441\u044f\u0446 \u043c\u044b \u043f\u043e\u043a\u0443\u043f\u0430\u0435\u043c \u043f\u0430\u043a\u0435\u0442 \u043c\u0438\u043d\u0443\u0442 \u043d\u0430 \u043a\u0430\u0436\u0434\u0443\u044e \u0441\u0438\u043c\u043a\u0443.<\/p>\n<p>  \u0414\u043b\u044f \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 \u043e\u0431\u044b\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0431\u043e\u0440 \u0441\u0438\u043c\u043e\u043a \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443, \u043f\u043e\u043a\u0430 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u0442\u0441\u044f \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u0430\u044f:<\/p>\n<p>  exten =&gt; _X.,n,Dial(SIP\/gsm1\/${EXTEN},,tT)<br \/>  exten =&gt; _X.,n,Dial(SIP\/gsm2\/${EXTEN},,tT)<br \/>  exten =&gt; _X.,n,Dial(SIP\/gsm3\/${EXTEN},,tT)<br \/>  \u0438 \u0442. \u0434.<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0447\u0435\u0440\u0435\u0437 \u043f\u0435\u0440\u0432\u0443\u044e \u0441\u0438\u043c\u043a\u0443, \u0430 \u043c\u0435\u043d\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0447\u0435\u0440\u0435\u0437 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043a \u0441\u0435\u0440\u0435\u0434\u0438\u043d\u0435 \u043c\u0435\u0441\u044f\u0446\u0430 \u043c\u0438\u043d\u0443\u0442\u044b \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0445 \u0441\u0438\u043c\u043a\u0430\u0445 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0440\u0430\u043d\u044c\u0448\u0435, \u0447\u0435\u043c \u043d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445, \u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f, \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u0437\u0432\u043e\u043d\u0438\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0447\u0435\u0440\u0435\u0437 4 \u0441\u0438\u043c\u043a\u0438 \u0438\u0437 8, \u0442\u0430\u043a \u043a\u0430\u043a \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0445 \u0447\u0435\u0442\u044b\u0440\u0435\u0445 \u043c\u0438\u043d\u0443\u0442\u044b \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0438\u0441\u044c. \u042d\u0442\u043e \u043f\u043b\u043e\u0445\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f 4 \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u043b\u0438\u043d\u0438\u0438 \u0432\u043c\u0435\u0441\u0442\u043e 8.<\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u044d\u0442\u043e\u0433\u043e \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c, \u043d\u0443\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0437\u043e\u0432\u044b \u043d\u0435 \u0432 \u043e\u0434\u043d\u043e\u043c \u0438 \u0442\u043e\u043c \u0436\u0435 \u043f\u043e\u0440\u044f\u0434\u043a\u0435, \u0430 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u043e\u0441\u0442\u0430\u0442\u043a\u043e\u043c \u043c\u0438\u043d\u0443\u0442 \u043d\u0430 \u0441\u0438\u043c\u043a\u0430\u0445.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-282736","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/282736","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=282736"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/282736\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=282736"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=282736"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=282736"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}