How to extract cookie values from iCab?
The problem:
I'm trying to configure iSiloX to access a particular site on my Palm. The iSilo support people tell me I need to manually add a cookie to my iSiloX data. To do this I need to go into a browser, find the list of stored cookies, identify the particular cookie I need, and copy the value of said cookie.
The solution:
There are two steps involved:
- getting the relevant data
- inserting that data in the right way
As to the latter, you'd need to know what format is required. I wouldn't be surprised if for instance the date notation would be quite different in different user-agents. In that case you would need to know both user-agents' formats in order to be able to convert from one to the other. A user-agent is likely to be using some common format, but of course they could be doing something unusual, or even unique.
As to the former: iCab's Cookie Manager should show you all your cookies in a human-readable format. That windows doesn't allow copying the data, so the easiest approach would be to write it down, then type it into the target (first converting it to the target's format of course, if necessary).
However, for some cookies the data in the
Value
column of iCab's Cookie Manager may be too long. It just doesn't fit the window. In that case you'll need to look it up in the cookies file itself: ~/Library/Preferences/iCab Preferences/iCab Cookies. Make a copy of that file and open the copy in BBEdit and locate the value you need.
Tip:
If your cookies file already contains a lot of cookies that will obscure things. A way to make things more clear would be to quit icab, move its cookies file elsewhere, launch iCab, log into the site and have the cookie be created, quit iCab, move its new cookies elsewhere and put the old cookies file back. Now open the new cookies file in BBedit. It will contain only the cookie(s) created for the one site you're interested in.
If you do need that approach, be careful, as the way cookies and their individual fields/values are stored is not that straightforward. It's not good old TAB or comma-delimited. If you alternate between looking at it in BBEdit, and in iCab's Cookie manager may help you figuring out the format. That's what I did, and to me it format looks to be something like this:
-
Date
indicates the start of a new cookie
- a value I presume represents the date the cookie was created (and/or its expiry date)
-
Cook
- some single character seemingly functioning as a separator
- a value that in iCab's Cookie manager is listed under the
Name
column
- domain name
- some single character
- value of the Path column in iCab's Cookie Manager
- some single character
- value of the cookie (this will often be the longest string - good chance it may consist only of ASCII characters, but I haven't checked the cookie specs)
- possibly another single character
- some value (presumably the original date or the expiry date)
- possibly a last single character before the next cookie starts (indicated again by
Date
)
-- Sander Tekelenburg,
http://www.euronet.nl/~tekelenb/
There also is a low-geek alternative if you know the name of the cookie: Open a copy of the iCab Cookies file in plain ordinary Text-Edit. Do a simple
find
in Text-Edit for the cookie's name and you will get to it with no problems. A comparison of the long list of characters in the cookie code with the beginning and ending characters visible in iCab's Cookie Manager make it easy to work out what text to select and copy. Paste that into the value field in iSiloX, convert the page, sync the palm and presto! it works.
-- Lance
If you run Mac OS X, you might also have luck using the following (high-geek, but still rather simple) alternative: Open the Terminal utility and type
strings
(without quotes, but with a trailing space). Then drag a copy of the iCab Cookies file onto the terminal window and press return. The Terminal now writes a long sequential list of all human-readable strings it could find in the cookies file; the iSilo cookie is somewhere in that list; you can find it using the
find
menu item.
--
ArneJohannessen