{"id":6,"date":"2010-10-26T08:40:45","date_gmt":"2010-10-26T08:40:45","guid":{"rendered":"http:\/\/www.hakancakiroglu.com\/wordpress\/?p=6"},"modified":"2011-01-13T23:36:19","modified_gmt":"2011-01-13T23:36:19","slug":"expect-paketi-ile-session-otomasyonu","status":"publish","type":"post","link":"https:\/\/www.hakancakiroglu.com\/wordpress\/?p=6","title":{"rendered":"Expect Paketi ile Session Otomasyonu"},"content":{"rendered":"<p>Linux da\u011f\u0131t\u0131mlar\u0131ndan herhangi birine &#8220;expect&#8221; paketi kurulumundan sonra yazd\u0131\u011f\u0131n\u0131z scriptlere input olarak sizin yazaca\u011f\u0131n\u0131z girdileri otomatik olarak scripte yazd\u0131rabilirsiniz. Bu ne demek oluyor k\u0131saca \u015f\u00f6yle a\u00e7\u0131klayay\u0131m.<!--more--><\/p>\n<p>\u00d6ncelikle &#8220;expect&#8221; paketini kurdu\u011funuzu varsay\u0131yorum. (packet manager ile kurmakta s\u0131k\u0131nt\u0131 ya\u015famass\u0131n\u0131z) Senaryomuz \u015f\u00f6yle olsun ; Diyelimki dosya payla\u015f\u0131m sitelerinden dosya indirdiniz ve yeni bir dosya indirmeden \u00f6nce beklemek istemiyorsunuz. Ya kalkacaks\u0131n\u0131z modeminizi a\u00e7\/kapa yapacaks\u0131n\u0131z tabi dinamik bir ip adresiniz varsa ya da modemin web aray\u00fcz\u00fcn\u00fc a\u00e7acaks\u0131n\u0131z modemi oradan restart edeceksiniz ya da telnet\/ssh ile login olup modemi bir \u015fekilde ba\u015ftan ba\u015flatacaks\u0131n\u0131z. Bu i\u015flemi\u00a0 &#8220;expect&#8221; paketi yard\u0131m\u0131yla tek bir script ile yapabilirsiniz.<\/p>\n<p>A\u015fa\u011f\u0131da telnet ile Airties bir modeme baglanarak modemi restart eden scripti ekliyorum. Bu scripti ihtiya\u00e7lar\u0131n\u0131za g\u00f6re de\u011fi\u015ftirip komut sat\u0131r\u0131ndan kullan\u0131c\u0131 girdileri ile yapt\u0131\u011f\u0131n\u0131z herhangi bir i\u015flemi otomaik hale getirebilirsiniz.<\/p>\n<pre>#!\/bin\/bash\r\n\r\nexpect &lt;&lt; EOF\r\nset timeout 20\r\nspawn telnet 192.168.1.1\r\nexpect \"BusyBox on localhost login: \"\r\nsend \"root\\r\"\r\nexpect \"Password: \"\r\nsend \"\\r\"\r\nexpect \"*#\"\r\nsend \"reboot\\r\"\r\nexpect \"*#\"\r\nsend \"exit\"\r\nexit\r\nEOF<\/pre>\n<p>Ho\u015funuza gidecek ba\u015fka bir senaryoya da uyarlayabilirsiniz. Mesela kendi sitenize ald\u0131g\u0131n\u0131z reklamlara ipnizi de\u011fi\u015ftirerek t\u0131klayan bir bota ne dersiniz \ud83d\ude09<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Linux da\u011f\u0131t\u0131mlar\u0131ndan herhangi birine &#8220;expect&#8221; paketi kurulumundan sonra yazd\u0131\u011f\u0131n\u0131z scriptlere input olarak sizin yazaca\u011f\u0131n\u0131z girdileri otomatik olarak scripte yazd\u0131rabilirsiniz.<\/p>\n<p class=\"read-more\"><a href=\"https:\/\/www.hakancakiroglu.com\/wordpress\/?p=6\">read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[],"_links":{"self":[{"href":"https:\/\/www.hakancakiroglu.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/6"}],"collection":[{"href":"https:\/\/www.hakancakiroglu.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hakancakiroglu.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hakancakiroglu.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hakancakiroglu.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6"}],"version-history":[{"count":0,"href":"https:\/\/www.hakancakiroglu.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/6\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.hakancakiroglu.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hakancakiroglu.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hakancakiroglu.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}