Commits

razzmataz committed 32244f6

committing stuff, bits to find hidden links in the moz places sqlite file,
grabbing image urls with urllister

  • Participants
  • Parent commits 76c05ed

Comments (0)

Files changed (2)

File firefox/moz-places.py

 # class for doing sqlalchemy reflection, pull that in,
 # 
 
+
+
 class Hidden(cmdln.Cmdln):
     name = "hidden"
 
         ${cmd_usage}
         """
         print "for hidden links"
+        dbpath = "sqlite:///" + placesdb
+        db = create_engine(dbpath)
+        metadata = MetaData(bind=db, reflect=True)
+        moz_historyvisits = metadata.tables['moz_historyvisits']
+        history_stmt = select([moz_historyvisits], whereclause=moz_historyvisits.c.visit_type==4)
+        moz_places = metadata.tables['moz_places']
+        hrows = history_stmt.execute()
+        hresults = hrows.fetchall()
+        for hr in hresults:
+            p_stmt = select([moz_places],whereclause=moz_places.c.id==hr.place_id)
+            p_res = p_stmt.execute()
+            vdate = prtime_to_utc(pr_time=hr.visit_date)
+            print "type 4 on: %s %s %s" %(vdate.year, vdate.month, vdate.day)
+            for p in p_res.fetchall():
+                print "%s %s %d" %(unicode(p.url).encode("utf-8"),
+                                   unicode(p.title).encode("utf-8"), p.visit_count)
 
 
 

File utils/urllister.py

         if href:
             self.urls.extend(href)
 
+
+class ImgLister(SGMLParser):
+
+    def reset(self):
+        SGMLParser.reset(self)
+        self.imgsrcs = [ ]
+
+    def start_img(self,attrs):
+        imgsrc = [v for k, v in attrs if k == 'src']
+        if imgsrc:
+            self.imgsrcs.extend(imgsrc)