# DESCRIPTION: # This script upload a file to a free yahoo geocities web-site account # It needs to work in conjunction with a script called 'login-geocities.sh' # which gets the necessary headers (cookies) file, to make the geocities server # believe that it is dealing with a genuine 'interactive' web-browser rather # than the various unix webtools as below # # # NOTES: # # This script appears to be currently working. A file can be uploaded to the # yahoo geocities account using this command line script # # # 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 this script, # 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: # getYMail.txt # this was an earlier incarnation of this script which was designed to # extract mail from a Yahoo Mail Account. This script is currently not # working because of some changes Yahoo have made to the way in which the # login process happens. However these changes should be easily # accomodated for. # login-geocities.sh # This script does the 'hard work' of logging in to the geocities server and # getting the necessary cookies file # # Dependencies: # curl # this unix program does all the hard work, including the actual uploading of the # a bash shell # login-geocities.sh # This script is really necessary for the present script to do anything useful # # AUTHOR: mj bishop (matth3wbishop@yahoo.com) # #*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--* sInitialUrl="http://www.geocities.com" sHeadersFileName="headers.txt" sTargetDirectory="" sResultPage="junk.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 fileToUpload [targetDirectory] [cookieFileName] " cat $0 | sed -n "/^[ ]*#[^-]/p" exit 1; else sUploadFile="$1" fi if [ "$2" != "" ] then sTargetDirectory="$2" fi if [ "$3" != "" ] then sHeadersFileName="$3" fi sBaseUrl="http://geocities.yahoo.com" #- used for debugging if [ "y" = "x" ] then echo " sHeadersFileName=$sHeadersFileName sUploadFile=$sUploadFile sTargetDirectory=$sTargetDirectory sUserAgent=$sUserAgent sBaseUrl=$sBaseUrl" fi #- The -L switch below automatically follows redirection instructions sent by the #- yahoo geocities server. If the 'headers file' which we are using (and which should #- contain the correct cookies to allow access to the 'internal' or 'logged in' parts #- of the geocities account) is no good, then the geocities server will redirect the #- web-client back to the login page. However, if the headers file is OK (the cookies #- have not expired, etc), the no redirect will be issued by the web-server, and in #- this case the -L switch will not be needed. #- The -A switch is the browser which curl is pretending to be. This is not necessary #- but seems prudent #curl -A "$sUserAgent" -L -b $sHeadersFileName $sBaseUrl/filemanager/upload > other-side.html #-- Curl syntax # directory=&op-uploadtodir=upload+files # -F/--form Specify HTTP POST data (H) #- Disguise what we are; follow redirections; send back cookies curl \ -A "$sUserAgent" -L -b $sHeadersFileName \ -F "userfile=@$sUploadFile;type=text/plain" \ -F "op-upload=upload+files" \ -F "directory=$sTargetDirectory" $sBaseUrl/filemanager/upload > $sResultPage #cat $sResultPage | grep -Ei "(input|form)" #- If the resulting html page contains a password login box then we #- probably can assume that the cookie/headers file was not accepted for some reason sLoginBox="" sErrorFlag="" sSuccessFlag="" sLoginBox=$(cat $sResultPage | grep -Ei "