{"id":330,"date":"2009-12-18T15:25:51","date_gmt":"2009-12-18T09:55:51","guid":{"rendered":"https:\/\/kunaldua.local\/blog\/?p=330"},"modified":"2009-12-18T15:25:51","modified_gmt":"2009-12-18T09:55:51","slug":"reliance-wireless-broadband-auto-login-script","status":"publish","type":"post","link":"https:\/\/kunaldua.com\/blog\/2009\/12\/18\/reliance-wireless-broadband-auto-login-script\/","title":{"rendered":"Reliance Wireless broadband auto-login (and logout) script(s)"},"content":{"rendered":"<p>The old &#8220;curl&#8221; based method stopped working yesterday when Reliance got a new login page as well as a new backend. It seems Reliance is now also looking at Cookies during authentication. Here&#8217;s a little Python script that you can execute to automate the process.<\/p>\n<p>If you don&#8217;t know what Python is, you better stick to browser based authentication \ud83d\ude42<\/p>\n<p>Needless to say, you can schedule this script as a cron\/ launchd job to run periodically and keep you logged in. That&#8217;s how I use it, which is why the script doesn&#8217;t output anything to prevent unnecessary log &#8220;pollution&#8221;.<\/p>\n<p><strong>Login Script for Python 2.x<\/strong><\/p>\n<pre lang=\"python\" line=\"1\">\n#!\/usr\/bin\/env python\n# encoding: utf-8\n\"\"\"\nReliance Login Script for Python 2.x v1.0\n\nCreated by Kunal Dua on 2009-12-18\n<blockquote class=\"wp-embedded-content\" data-secret=\"LYSljy04yv\"><a href=\"https:\/\/kunaldua.com\/blog\/2009\/12\/18\/reliance-wireless-broadband-auto-login-script\/\">Reliance Wireless broadband auto-login (and logout) script(s)<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; visibility: hidden;\" title=\"&#8220;Reliance Wireless broadband auto-login (and logout) script(s)&#8221; &#8212; Kunal Dua\" src=\"https:\/\/kunaldua.com\/blog\/2009\/12\/18\/reliance-wireless-broadband-auto-login-script\/embed\/#?secret=CFAlBZ4kG5#?secret=LYSljy04yv\" data-secret=\"LYSljy04yv\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n\nThis program is free software; you may redistribute it and\/or\nmodify it under the same terms as Python itself.\n\"\"\"\n\nimport urllib2, urllib, cookielib\n\nusername = '1111111111111111' #replace the text within quotes with your username\npassword = 'password'\t#replace the text within quotes with your password\n\njar = cookielib.FileCookieJar(\"cookies\")\nopener = urllib2.build_opener(urllib2.HTTPCookieProcessor(jar))\n\nresponse = opener.open(\"http:\/\/10.239.89.15\/reliance\/startportal_isg.do\")\n\nlogin_data = urllib.urlencode({'userId' : username, 'password' : password, 'action' : 'doLoginSubmit'})\nresp = opener.open('http:\/\/10.239.89.15\/reliance\/login.do', login_data)\n<\/pre>\n<p>Update: <strong>Logout Script for Python 2.x<\/strong><\/p>\n<pre lang=\"python\" line=\"1\">\n#!\/usr\/bin\/env python\n# encoding: utf-8\n\"\"\"\nReliance Logout Script v1.0\n\nCreated by Kunal Dua on 2009-12-22\nhttps:\/\/kunaldua.com\/blog\/?p=323\n\nThis program is free software; you may redistribute it and\/or\nmodify it under the same terms as Python itself.\n\"\"\"\n\nimport urllib2, cookielib\n\njar = cookielib.FileCookieJar(\"cookies\")\nopener = urllib2.build_opener(urllib2.HTTPCookieProcessor(jar))\n\nresponse = opener.open(\"http:\/\/10.239.89.15\/reliance\/login.do\", timeout=2)\n\nresp = opener.open('http:\/\/10.239.89.15\/reliance\/logout.do')\n<\/pre>\n<p>Update: <strong>Login Script for Python 3.x<\/strong><\/p>\n<pre lang=\"python\" line=\"1\">\n#!\/usr\/bin\/env python\n# encoding: utf-8\n\"\"\"\nReliance Login Script for Python 3.0 v1.0\n\nCreated by Kunal Dua on 2009-12-30\nhttps:\/\/kunaldua.com\/blog\/?p=323\n\nThis program is free software; you may redistribute it and\/or\nmodify it under the same terms as Python itself.\n\"\"\"\n\nimport urllib, http.cookiejar\n\nusername = '1111111111111111' #replace the text within quotes with your username\npassword = 'password'\t#replace the text within quotes with your password\n\njar = http.cookiejar.FileCookieJar(\"cookies\")\nopener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(jar))\n\nresponse = opener.open(\"http:\/\/10.239.89.15\/reliance\/startportal_isg.do\")\n\nlogin_data = urllib.parse.urlencode({'userId' : username, 'password' : password, 'action' : 'doLoginSubmit'})\nresp = opener.open('http:\/\/10.239.89.15\/reliance\/login.do', login_data)\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The old &#8220;curl&#8221; based method stopped working yesterday when Reliance got a new login page as well as a new backend. It seems Reliance is now also looking at Cookies during authentication. Here&#8217;s a little Python script that you can execute to automate the process. If you don&#8217;t know what Python is, you better stick<a class=\"more-link\" href=\"https:\/\/kunaldua.com\/blog\/2009\/12\/18\/reliance-wireless-broadband-auto-login-script\/\">Continue reading <span class=\"screen-reader-text\">&#8220;Reliance Wireless broadband auto-login (and logout) script(s)&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"enabled":false},"version":2}},"categories":[6,17,38,43],"tags":[],"class_list":["post-330","post","type-post","status-publish","format-standard","hentry","category-code","category-india","category-unix","category-www","entry"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/kunaldua.com\/blog\/wp-json\/wp\/v2\/posts\/330","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kunaldua.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kunaldua.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kunaldua.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kunaldua.com\/blog\/wp-json\/wp\/v2\/comments?post=330"}],"version-history":[{"count":1,"href":"https:\/\/kunaldua.com\/blog\/wp-json\/wp\/v2\/posts\/330\/revisions"}],"predecessor-version":[{"id":434,"href":"https:\/\/kunaldua.com\/blog\/wp-json\/wp\/v2\/posts\/330\/revisions\/434"}],"wp:attachment":[{"href":"https:\/\/kunaldua.com\/blog\/wp-json\/wp\/v2\/media?parent=330"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kunaldua.com\/blog\/wp-json\/wp\/v2\/categories?post=330"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kunaldua.com\/blog\/wp-json\/wp\/v2\/tags?post=330"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}