LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-01-2009, 12:33 PM   #31
Completely Clueless
Member
 
Registered: Mar 2008
Location: Marbella, Spain
Distribution: Many and various...
Posts: 814

Original Poster
Rep: Reputation: 69

Hi Pixellany,

Hopefully Charles will materialize at some stage to answer your queries. I'll just say quickly that on my system at least, Firefox is NOT compressing the cache and all the data therein is readily readable as it is.
 
Old 08-01-2009, 04:06 PM   #32
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Quote:
Originally Posted by Completely Clueless View Post
Hi Pixellany,

Hopefully Charles will materialize at some stage to answer your queries. I'll just say quickly that on my system at least, Firefox is NOT compressing the cache and all the data therein is readily readable as it is.
My post was only a few comments on syntax----I don't know anything about "compressing the cache" or how it is relevant to my comments......
 
Old 08-01-2009, 07:05 PM   #33
Completely Clueless
Member
 
Registered: Mar 2008
Location: Marbella, Spain
Distribution: Many and various...
Posts: 814

Original Poster
Rep: Reputation: 69
Quote:
Originally Posted by pixellany View Post
My post was only a few comments on syntax----I don't know anything about "compressing the cache" or how it is relevant to my comments......
Ah! I remember you said you hadn't read the thread. This issue with cache compression is only of relevance to Ptrenholme and Catkin, then.
BTW, I like your 'confused' smilies. :-) As a moderator, do you get access to a wider range of smilies than we mere mortals?

Last edited by Completely Clueless; 08-01-2009 at 07:07 PM.
 
Old 08-02-2009, 07:09 AM   #34
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Hello pixellany

Thanks for your observations.
Quote:
Originally Posted by pixellany View Post
I have not followed this thread, but some things jump out at me:
Code:
block="$(dd if=/dev/sda4 skip=$i count=4 2>/dev/null)"
Did you mean to assign the literal string to block? If you meant to assign the result of the dd command, then you don't want the outer quotes.
I believe the outer quotes are necessary in case the output from dd contains whitespace in which case bash would try to run anything following the first whitespace as a command.

Quote:
Originally Posted by pixellany View Post
Code:
[[ $? -ne 0 ]] && exit
Do you mean to test the exit code of dd? It seems that this might be testing the exit code of the assignment statement
Yes. I don't think an assignment statement sets an exit status. I'm confident about this because I use the idiom extensively in my scripts.

Quote:
Originally Posted by pixellany View Post
Code:
echo "$block" | grep -iaC 5 'xyz@hotmail.com' | hexdump -C >> out
This echos the literal string "$block"---I think you meant "echo $block" (without the quotes)
Probably doesn't make much functional difference in this case but the double quotes are used to prevent bash converting any sequence of whitespace (actually IFS) bytes to a single space (actually the first byte of IFS?).

Best

Charles
 
Old 08-02-2009, 07:15 AM   #35
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Quote:
Originally Posted by Completely Clueless View Post
Hi Pixellany,

Hopefully Charles will materialize at some stage to answer your queries. I'll just say quickly that on my system at least, Firefox is NOT compressing the cache and all the data therein is readily readable as it is.
Shazaam! Genie-like I have materialised!

Some (most) are, some are not, assuming I have correctly identified the Firefox cache directory:
Code:
c@CW8:~/.mozilla/firefox/te5sgphx.default/Cache$ for f in $(\ls -1 | tail)
> do
> file "$f"
> done
EE392DDBd01: PNG image data, 225 x 180, 8-bit/color RGB, non-interlaced
EEC6C76Ad01: ASCII HTML document text
EF79C92Dd01: gzip compressed data, from Unix
F0B46E58d01: data
F0D232C8d01: gzip compressed data, from Unix
F181554Ad01: HTML document text
F23AA90Fd01: gzip compressed data, from Unix
F99B22B9d01: gzip compressed data, from Unix
FCE9975Fd01: gzip compressed data, from Unix
FE4AF592d01: gzip compressed data, from Unix
This for Firefox 3.0.11 on ubuntu 8.04.2
 
Old 08-02-2009, 07:16 AM   #36
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
My mistake on the quotes---I was forgetting that the double quote allows "$" to be "value of". I had just never seen these actual constructs.
 
Old 08-02-2009, 04:10 PM   #37
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,186

Rep: Reputation: 346Reputation: 346Reputation: 346Reputation: 346
Following up on catkin's observation, here's a search scrip to search your cache files for some string or regexp:
Code:
#!/bin/bash                                                                                                                    
#                                                                                                                              
# Find a string in Firefox cache files                                                                                         
#                                                                                                                              
function local_help()                                                                                                          
{                                                                                                                              
  cat <<EOF                                                                                                                    
$0: Usage $0 [-h | --help] [-C nunber] [string | regexp]                                                                       

Argument: string - List all cache files containg the string
          regexp - List all cache files containg the regular expression

Options: -h | --help : Print this message
         -C number   : Number of context lines to print [Default: 5]

Note: grep is used for the search, and any unrecognized options wil be passed to
      grep unmodified.                                                          
EOF                                                                             
  exit 0                                                                        
}                                                                               
# Do we have any arguments? If not, print the help message and abort.           
[ $# -eq 0 ] && local_help                                                      
#                                                                               
# Get the list of cache files                                                   
files=$(find ~/.mozilla/ -name Cache)                                           
[ "$?" -ne 0 ] || [ -z "$files" ] && echo $0: No Mozilla cache files were found. && exit 0
html_files=                                                                               
zip_files=                                                                                
for f in $files/*; do                                                                     
  type=$(file $f | egrep -io '(gzip|html)')                                               
  case $type in                                                                           
    gzip) zip_files=$(echo "${zip_files}" " " "${f}"|sed 's/^ *//');;                     
    html|HTML) html_files=$(echo "${html_files}" " " "${f}" |sed 's/^ *//');;             
  esac                                                                                    
done                                                                                      
# Abort if we can't proceed.                                                              
[ -z "$html_files" -a -z "$zip_files" ] && echo No searchable Mozilla cache files were found. && exit 0
# Parse the arguments                                                                                  
Opt=$(getopt -o hC:: --long help -n "$0" -- "$@")                                                      
# Did that work?                                                                                       
[ $? -ne 0 ] && echo $0: Could not parse arguments. Aborting. >>2 && exit 1                            
eval set -- "$Opt"                                                                                     
C_arg=5                                                                                                
while true ; do                                                                                        
        case "$1" in                                                                                   
                -h|--help) local_help;;                                                                
                -C)                                                                                    
                        # C has an optional argument. Default a missing value to 5                     
                        case "$2" in                                                                   
                                "") shift 2 ;;                                                         
                                *)  C_arg=$2 ; shift 2 ;;                                              
                        esac ;;                                                                        
                --) shift ; break ;;                                                                   
                *) echo $0: Error parsing arguments ; exit 1 ;;                                        
        esac
done
arg=-iC$C_arg\ \'"$@"\'
#
# Run grep on each of the searchable cache files and report any matches
for f in $html_files;do
  grep -H $arg $f
done
for f in $zip_files;do
  gunzip -cS "" $f | grep -H --label "$f" $arg
done
And here's a test run on my system:
Code:
$ ./cache.sh http
/home/Peter/.mozilla/firefox/wrwczo08.default/Cache/76779E6Ad01-+"ion;s.tfs=w;if(p&&p.location!=l&&p.location.host==l.host){s.tfs=p;r"
/home/Peter/.mozilla/firefox/wrwczo08.default/Cache/76779E6Ad01-+"eturn s.gtfsf(s.tfs)}return s.tfs};s.gtfs=function(){var s=this;if("
/home/Peter/.mozilla/firefox/wrwczo08.default/Cache/76779E6Ad01-+"!s.tfs){s.tfs=s.wd;if(!s.etfs)s.tfs=s.cet('gtfsf',s.tfs,'gtfset',s."
/home/Peter/.mozilla/firefox/wrwczo08.default/Cache/76779E6Ad01-+"gtfsoe,'gtfsfb')}return s.tfs};s.mr=function(sess,q,ta){var s=this,"
/home/Peter/.mozilla/firefox/wrwczo08.default/Cache/76779E6Ad01-+"dc=s.dc,t1=s.trackingServer,t2=s.trackingServerSecure,ns=s.visitorN"
/home/Peter/.mozilla/firefox/wrwczo08.default/Cache/76779E6Ad01:+"amespace,unc=s.rep(s.fun,'_','-'),imn='s_i_'+s.fun,im,b,e,rs='http'"
/home/Peter/.mozilla/firefox/wrwczo08.default/Cache/76779E6Ad01-+"+(s.ssl?'s':'')+'://'+(t1?(s.ssl&&t2?t2:t1):((ns?ns:(s.ssl?'102':un"
/home/Peter/.mozilla/firefox/wrwczo08.default/Cache/76779E6Ad01-+"c))+'.'+(s.dc?s.dc:112)+'.2o7.net'))+'/b/ss/'+s.un+'/1/H.10-Pdvu-2/"
/home/Peter/.mozilla/firefox/wrwczo08.default/Cache/76779E6Ad01-+"'+sess+'?[AQB]&ndh=1'+(q?q:'')+(s.q?s.q:'')+'&[AQE]';if(s.isie&&!s."
/home/Peter/.mozilla/firefox/wrwczo08.default/Cache/76779E6Ad01-+"ismac){if(s.apv>5.5)rs=s.fl(rs,4095);else rs=s.fl(rs,2047)}if(s.d.i"
/home/Peter/.mozilla/firefox/wrwczo08.default/Cache/76779E6Ad01-+"mages&&s.apv>=3&&(!s.isopera||s.apv>=7)&&(s.ns6<0||s.apv>=6.1)){im="

gzip: /home/Peter/.mozilla/firefox/wrwczo08.default/Cache/882FCA52d01: unexpected end of file
/home/Peter/.mozilla/firefox/wrwczo08.default/Cache/88DFDF35d01-+"ion;s.tfs=w;if(p&&p.location!=l&&p.location.host==l.host){s.tfs=p;r"
/home/Peter/.mozilla/firefox/wrwczo08.default/Cache/88DFDF35d01-+"eturn s.gtfsf(s.tfs)}return s.tfs};s.gtfs=function(){var s=this;if("
/home/Peter/.mozilla/firefox/wrwczo08.default/Cache/88DFDF35d01-+"!s.tfs){s.tfs=s.wd;if(!s.etfs)s.tfs=s.cet('gtfsf',s.tfs,'gtfset',s."
/home/Peter/.mozilla/firefox/wrwczo08.default/Cache/88DFDF35d01-+"gtfsoe,'gtfsfb')}return s.tfs};s.mr=function(sess,q,ta){var s=this,"
/home/Peter/.mozilla/firefox/wrwczo08.default/Cache/88DFDF35d01-+"dc=s.dc,t1=s.trackingServer,t2=s.trackingServerSecure,ns=s.visitorN"
/home/Peter/.mozilla/firefox/wrwczo08.default/Cache/88DFDF35d01:+"amespace,unc=s.rep(s.fun,'_','-'),imn='s_i_'+s.fun,im,b,e,rs='http'"
/home/Peter/.mozilla/firefox/wrwczo08.default/Cache/88DFDF35d01-+"+(s.ssl?'s':'')+'://'+(t1?(s.ssl&&t2?t2:t1):((ns?ns:(s.ssl?'102':un"
/home/Peter/.mozilla/firefox/wrwczo08.default/Cache/88DFDF35d01-+"c))+'.'+(s.dc?s.dc:112)+'.2o7.net'))+'/b/ss/'+s.un+'/1/H.10-Pdvu-2/"
/home/Peter/.mozilla/firefox/wrwczo08.default/Cache/88DFDF35d01-+"'+sess+'?[AQB]&ndh=1'+(q?q:'')+(s.q?s.q:'')+'&[AQE]';if(s.isie&&!s."
/home/Peter/.mozilla/firefox/wrwczo08.default/Cache/88DFDF35d01-+"ismac){if(s.apv>5.5)rs=s.fl(rs,4095);else rs=s.fl(rs,2047)}if(s.d.i"
/home/Peter/.mozilla/firefox/wrwczo08.default/Cache/88DFDF35d01-+"mages&&s.apv>=3&&(!s.isopera||s.apv>=7)&&(s.ns6<0||s.apv>=6.1)){im="
 
Old 08-03-2009, 03:20 AM   #38
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,331
Blog Entries: 55

Rep: Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529
Quote:
Originally Posted by PTrenholme View Post
gunzip -cS "" $f | grep -H --label "$f" $arg
You mean 'zgrep'.


Quote:
Originally Posted by Completely Clueless View Post
I'd have thought your suggestions are rather overkill? It should be something that can be flagged as a match using some 'dd' scan of the entire partition as suggested by Charles.
While the thread makes for a nice read and serves as a good example of collaborative achievement, it still illustrates clearly that by using the right tools for the job anyone (else) would have gotten the strings within an hour or so. Reliably, efficiently and regardless of where it resides on disk. Then again one of your other recent threads shows "completely clueless" translates to something like "stubbornly bang head against wall repeatedly" instead of "learn how to work the system the way it is intended"... ;-p
 
Old 08-03-2009, 08:09 AM   #39
Completely Clueless
Member
 
Registered: Mar 2008
Location: Marbella, Spain
Distribution: Many and various...
Posts: 814

Original Poster
Rep: Reputation: 69
Talking

Quote:
Originally Posted by unSpawn View Post
[snip]Then again one of your other recent threads shows "completely clueless" translates to something like "stubbornly bang head against wall repeatedly" instead of "learn how to work the system the way it is intended"... ;-p
Er, yes well the problem is, I'm a non-nerd of precisely the kind the Linux core community needs to win over to completely demolish Windows. Linux has come a long way over the last 17 years or however long it is. I'm a confirmed fan and now use nothing else. But I can see some of its remaining shortcomings as an outsider perhaps better than you more technically-able people. In fact there's no "perhaps" about it!
 
Old 08-03-2009, 12:16 PM   #40
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,186

Rep: Reputation: 346Reputation: 346Reputation: 346Reputation: 346
Quote:
Originally Posted by unSpawn View Post
You mean 'zgrep'. ...
Thanks. I didn't know about the zgrep script. That script is somewhat more sophisticated than my simple one, although using getopt might have simplified that script. I do note that, at the core, Mr. Gailly's script does a gzip -cdfq piped into grep which, if you look at the gunzip script:
Code:
!/bin/sh
PATH=${GZIP_BINDIR-'/bin'}:$PATH
exec gzip -d "$@"
is, essentially, what I did.

Re your other remarks about CC, I suggest that we avoid ad hominem comments. Such comments seldom produce any positive response from either the person attacked or from others reading the comment.
 
Old 08-03-2009, 12:45 PM   #41
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,331
Blog Entries: 55

Rep: Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529
Quote:
Originally Posted by PTrenholme View Post
Such comments seldom produce any positive response from either the person attacked or from others reading the comment.
Thanks. If one takes it as an attack then, yes. But as he fails to see it has nothing to do with shortcomings I rest my case.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Searching a string from the file amty Programming 6 11-06-2008 08:04 AM
searching for char string containing a '/' cleopard Programming 3 08-14-2008 05:17 PM
C++: need helping searching for multiple items in a string BrianK Programming 20 02-21-2008 03:59 PM
searching for a string of charcters in some files hhegab Programming 2 04-16-2005 06:07 PM
Searching for a string krazykow Solaris / OpenSolaris 1 03-17-2005 12:55 PM


All times are GMT -5. The time now is 10:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration