#- Description: #-- This script logs onto a particular Yahoo! Geocities WebSite #-- account #-- #-- A description of the process of the script is as #-- follows: #-- 1) Get the Yahoo! Geocities Login Form from http://www.geocities.com #-- 2) Put the user account information into the form #-- (user-name & password) #-- 3) Reformat the 'input' fields in the form so that #-- they can be used by the curl -d switch #-- (i.e. strip html tags, url encode fields, remove #-- newline characters etc) #-- 4) Post (submit) this information to the Form's target #-- and save any cookies and headers which the server #-- sends. Also follow any redirects which the server #-- specifies. Save these cookies into a file called headers.txt or # maybe something else #-- #-- #-- NOTES: #-- This appears to be succesfully logging in to the geocities server. # (august 2003) # #-- The script needs to overcome several devices used #-- by yahoo. #-- a) The use of cookies #-- b) The use of automatic redirects of the web-client #-- (using the LOCATION http header field) #-- c) The use of ssl to encrypt the logon process #-- d) The use of hidden fields with random numbers within #-- the Yahoo! Mail Log-in Form to discourage automatic logins #-- #-- These things can all be overcome because of the #-- capabilities of the 'curl' non-interactive web client. #-- #-- This script has been got to work on Linux (Redhat), and an older version # worked on the cygwin shell on Microsoft Windows # #-- NOTE TO YAHOO ENGINEERS: #-- This script was not written out of malicious-ness #-- towards yahoo but because I am not able to get #-- a credit card since I dont have a job currently #-- and therefore I am not able to pay for a 'premium' #-- package which includes pop forwarding of mail (or ftp access to yahoo #-- geocities). #-- #-- Revisions: #-- may 2002, I created the script 'getYMail.txt' which was the antecedent to this # one #-- august 2003, Barcelona, I am revising this script in order to adapt it #-- to uploading a file to a free geocities account. Also I would like to #-- rewrite this as a java application, (even an applet, although that is a little #-- optimistic) so that it could be used from an internet cafe or from some #-- other somewhat 'hostile' location. # See Also: # upload-geocities.sh # # # Dependencies: # # A reasonable Bash shell, a good 'sed' # Author: mj bishop (matth3wbishop@yahoo.com) #-- #--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--* sTargetUrl="" #-- The initial target of the login form sInitialUrl="http://www.geocities.com" sAccountPassword="" sAccountName="matth3wbishop" sResultPage="other-side.html" sFormDataFile="form-data.txt" #- The path below is useful for running under the cygwin shell which for #- some reason mounts the hard drives on this path (cygdrive) # -- sCookieFileName="/cygdrive/c/mjb/headers.txt" # sCookieFileName="/tools/geoftp/headers.txt" sCookieFileName="headers.txt" #- This file will contain a set of headers which the yahoo geocities server #- sends back to the users browser during the login process. These headers contain #- the necessary cookies required to 'maintain' the yahoo geocities session. #-- Extract the form fields from the html #-- #- Here are few example user agent strings to disguise ourselves with sUserAgent='Lynx/2.7.1 libwww-FM/2.14' sUserAgent='Lynx (Linux; U; Redhat Linux; en-US;' sUserAgent='Mozilla/4.05 [en] (X11; U; Linux 2.0.32 i586)' if [ "$1" = "" ] then echo "usage: $0 accountPassword accountName " cat $0 | sed -n "/^[ ]*#/p" exit 1; else sAccountPassword="$1" fi if [ "$2" != "" ] then sAccountName="$2" fi curl -L -A "$sUserAgent" http://www.geocities.com > login-form.html sTargetUrl=$(uexpand login-form.html | sed -n '/