Connect With Me In Facebook

Welcome to DefendHackers, If u want to Apply for a Blogroll as a Author , With h4ckfreak Mail me @ suren.click@gmail.com

Mark Zuckerberg tells 8th graders “there’s no shortcuts” and to make friends

By h4ckfreak

Metasploit Quick Start Referennce Guide

Metasploit Quick Start Referennce Guide , By h4ckfreak

IP Security

IP Security By H4ckfreak.

15 Network Admin Apps for Android

15 Network Admin Apps for Android , By h4ckfreak

Break All OS Passwords Using KON

Break All OS Passwords Using KON , By h4ckfreak

Recover Or Reset Ur Windows Pwd Using Ubuntu

Recover Or Reset Ur Windows Pwd Using Ubuntu , By h4ckfreak

Security Blueprint For Ethical Hackers..

By h4ckfreak

Blocking IP Using IPSec

By h4ckfreak

Preventing DDos Attacks, Combat Steps abd Tools...

By h4ckfreak

Tuesday, February 2, 2010

Gmail Architecture

Gmail Architecture

Gmail Logo
Gmail is the best application website i ever seen. Simple implementation, Super Ajax, Cute Chatting, Status Messages, Fast Mail Checking, Live updating and its features are endless as my wordpress database wont withstand
when you type: www.gmail.com, the following action will happen. See it is very interesting.
Script1
It first load the javascript file : https://mail.google.com/mail?view=page&name=browser&ver=1k96igf4806cy
It checks the browser type, os etc
the function navigator.userAgent.toLowerCase() checks with opera, msie,mac,gecko,safari,palmsource,regking,windows ce,avantgo,stb,pda; sony/com2 etc browsers
that is script 1’s job.
Script 2 calculate the round trip time for a 1 pixel image. This is for finding the internet speed of the user
function GetRoundtripTimeFunction(start)
{
return function()
{
var end = (new Date()).getTime();
SetGmailCookie(”GMAIL_RTT”, (end – start));
}
}
Since gmail uses iframes , this script also make sure to load the actual home
top.location = self.location.href
It also set cookie to show which of the google service is using.
Then loads the login form and set focus on password field.
Gmail Login
Script 3 handles the https connection and cookie settings for secured login
Yet the web 2.0 concept is on the peak, gmail uses table layout design instad of div style designs :)
Gmail’s login form ’s action is pointing to “https://www.google.com/accounts/ServiceLoginAuth?service=mail”
This is the general url for google account login. Here service=mail parameter indicates , this is gmail logging
When the logging verification done, the page is redirected into corresponding service by javascript:
location.replace(”http://www.google.co.in/accounts/SetSID?……etc etc”);
After setting proper session and cookies for login, the non secured site http://mail.google.com/mail page automatically get refresh by this meta tag:
When loading the mail page after setting proper login sessions, around 28 ajax web request begin to start, and load all the mails, labels, channels etc
The above mentioned all javascript is also here in this mail loading page
The first division (div) inside the body tag is that for loading. A while text “loading…” with red backgroud.

Loading…
This is the waiting symbol for all the ajax call to load
Loading
There is also a timer is working to check the loading time of ajax requests. If it takes more time than expected (or calculated), it show this error “This seems to be taking longer than usual”
Automatically they provide navigation links for basic html version.
The total page of gmail is created by a set of iframes
viz
HIST_IFRAME
SOUND_IFRAME
CANVAS_IFRAME
JS_IFRAME
The Sound_Iframe session loads a flash object (shock wave file) for playing the sound , when chat works. (Google chat indicator)
Chat window
Gmail saves each sections- labels, inbox, mails etc in array with a unique id. This unique id is for checking the updations on the fly using ajax.
For example : http://mail.google.com/mail/?ui=2&ik=42e598c952&view=tl&start=50&num=70&auto=1&ari=120&rt=j&search=inbox
The above url pics all the data as javascript array format. Check this link after logging in gmail. You can see your labels, your from email accounts, your settings,
your last arrived 70 emails subject and from etc information in javascript array format.
This is the url which is to be called when you click older and newer mail (pagination below)
Gmail always call this url : http://mail.google.com/mail/channel/bind?at=xn3j2zpul6ptan694kr6javrldi43s&VER=6&it=93079&SID=584B451AB93DBDC&RID=16351&zx=lniy7w-6psisw&t=1
(leave the parameters value) for checking updatations. This is gmails rpc checking for new updations .
If there is any updation new rpc with post method automatically called to get new data. The calling url is same , the one above
http://mail.google.com/mail/?ui=2&ik=42e598c952&view=tl&start=0&num=70&auto=1&ari=120&rt=j&search=inbox
It results new data as javascript array format. The rest of the arrangements are handled by the script from client side.
Whenever you open a mail from inbox, the browser send another request for loading the sponsered links (advtisement) though this rpc
http://mail.google.com/mail/?ui=2&ik=42e598c952&view=ad&th=118e57dc03d67f16&search=inbox
The CANVAS_IFRAME is the main iframe contains all the layout of gmail
It contains the left side chat, main inbox or mails right side ads, and all the controls
The left side chat is created using table.
JS_IFRAME contains all the javascripts files for gmail full implementation. There are around 89 js files.
Chat
When you chat with somebody, the url calling is : http://mail.google.com/mail/channel/bind?at=xn3j2zpul6ptan694kr6javrldi43s&VER=6&it=891&SID=7D4E9A779225DC1&RID=50595&zx=hrsqkf-nwummu&t=1
as POST method with parameters:
req2_text
req2_to
req0_type cf
req1_cmd a
req0_focused 1
Now,
http://mail.google.com/mail/channel/bind?at=xn3j2zpul6ptan694kr6javrldi43s&VER=6&it=531&RID=rpc&SID=48DD6BA8E1D3A326&CI=1&AID=176&TYPE=xmlhttp&zx=m0iiwn-ok5jqr&t=1
the above url return the chat friends and theire status messages
==========================================================
Same url is using for getting the chat messages.
For example when kenney.jacob@gmail chat with me , the message comes as an array like this:
[184,["m","kenney.jacob@gmail.com","730DFDF6F013F640_161","active","hi da","hi da",1206444193169,
,,0,0,0,0,[]
,”square”]
Foster says
Here active implies the chat is active or not (the window with orange color) and with a chat alert if the window is not active.
http://mail.google.com/mail/channel/test?at=xn3j2zpul6ptan694kr6javrldi43s&VER=6&it=24343&MODE=init&zx=1vyx51-ze670&t=1
The above url checks whether the chat is enable or not. which returns an array:
["b","chatenabled"]