Automatic login script for a website on windows machine? Automatic login script for a website on windows machine? windows windows

Automatic login script for a website on windows machine?


From the term "automatic login" I suppose security (password protection) is not of key importance here.

The guidelines for solution could be to use a JavaScript bookmark (idea borrowed form a nice game published on M&M's DK site).

The idea is to create a javascript file and store it locally. It should do the login data entering depending on current site address. Just an example using jQuery:

// dont forget to include jQuery code// preferably with .noConflict() in order not to break the site scriptsif (window.location.indexOf("mail.google.com") > -1) {    // Lets login to Gmail    jQuery("#Email").val("youremail@gmail.com");    jQuery("#Passwd").val("superSecretPassowrd");    jQuery("#gaia_loginform").submit();}

Now save this as say login.js

Then create a bookmark (in any browser) with this (as an) url:

javascript:document.write("<script type='text/javascript' src='file:///path/to/login.js'></script>");

Now when you go to Gmail and click this bookmark you will get automatically logged in by your script.

Multiply the code blocks in your script, to add more sites in the similar manner. You could even combine it with window.open(...) functionality to open more sites, but that may get the script inclusion more complicated.

Note: This only illustrates an idea and needs lots of further work, it's not a complete solution.


The code below does just that. The below is a working example to log into a game. I made a similar file to log in into Yahoo and a kurzweilai.net forum.

Just copy the login form from any webpage's source code. Add value= "your user name" and value = "your password". Normally the -input- elements in the source code do not have the value attribute, and sometime, you will see something like that: value=""

Save the file as a html on a local machine double click it, or make a bat/cmd file to launch and close them as required.

    <!doctype html>    <!-- saved from url=(0014)about:internet -->    <html>    <title>Ikariam Autologin</title>    </head>    <body>    <form id="loginForm" name="loginForm" method="post"    action="http://s666.en.ikariam.com/index.php?action=loginAvatar&function=login">    <select name="uni_url" id="logServer" class="validate[required]">    <option  class=""  value="s666.en.ikariam.com" fbUrl=""  cookieName=""  >            Test_en    </option>    </select>    <input id="loginName" name="name" type="text" value="PlayersName" class="" />    <input id="loginPassword" name="password" type="password" value="examplepassword" class="" />    <input type="hidden" id="loginKid" name="kid" value=""/>                        </form>  <script>document.loginForm.submit();</script>         </body></html>

Note that -script- is just -script-. I found there is no need to specify that is is JavaScript. It works anyway. I also found out that a bare-bones version that contains just two input filds: userName and password also work. But I left a hidded input field etc. just in case. Yahoo mail has a lot of hidden fields. Some are to do with password encryption, and it counts login attempts.

Security warnings and other staff, like Mark of the Web to make it work smoothly in IE are explained here:

http://happy-snail.webs.com/autologinintogames.htm


I used @qwertyjones's answer to automate logging into Oracle Agile with a public password.

I saved the login page as index.html, edited all the href= and action= fields to have the full URL to the Agile server.

The key <form> line needed to change from

<form autocomplete="off" name="MainForm" method="POST" action="j_security_check"  onsubmit="return false;" target="_top">

to

<form autocomplete="off" name="MainForm" method="POST" action="http://my.company.com:7001/Agile/default/j_security_check"    onsubmit="return false;" target="_top">

I also added this snippet to the end of the <body>

<script>function checkCookiesEnabled(){ return true; }document.MainForm.j_username.value = "joeuser";document.MainForm.j_password.value = "abcdef";submitLoginForm();</script> 

I had to disable the cookie check by redefining the function that did the check, because I was hosting this from XAMPP and I didn't want to deal with it. The submitLoginForm() call was inspired by inspecting the keyPressEvent() function.