def Run(self, options, args): if len(args) == 0: self.print_help() self.exit() store = StoreClient(options.user, options.store) cols = ["Name"] rows = [] try: ab = self._FindAddressbook(store, args[0]) if ab is None: print "Could not find addressbook named '%s'" % args[0] return contacts = list(store.List(ab.uid, ["nmap.document"])) for contact in contacts: jsob = simplejson.loads(contact.props["nmap.document"].strip()) name = jsob.get("fn") rows.append((name,)) finally: store.Quit() rows.sort() print table.format_table(cols, rows)
def Run(self, options, args): store = StoreClient(options.user, options.store) cols = ["Name"] rows = [] try: abs = list(store.List("/addressbook")) for ab in abs: rows.append((ab.filename,)) finally: store.Quit() print table.format_table(cols, rows)
def Run(self, options, args): store = StoreClient(options.user, options.store) cols = ["subd?", "Name", "Url"] rows = [] try: cals = list(store.List("/calendars", props=["bongo.calendar.url"])) for cal in cals: subd = cal.props.has_key("bongo.calendar.url") and "Yes" or None rows.append([subd, cal.filename, cal.props.get("bongo.calendar.url")]) finally: store.Quit() print table.format_table(cols, rows)
def Run(self, options, args): store = StoreClient(options.user, options.store) cols = ["Summary", "Start", "End"] rows = [] try: cal = self._FindCalendar(store, args[0]) if cal is None: print "Could not find calendar named '%s'" % args[0] return events = list(store.Events(cal.uid, ["nmap.document", "nmap.event.calendars"])) for event in events: jsob = simplejson.loads(event.props["nmap.document"].strip()) comp = jsob["components"][0] summary = comp.get("summary") if summary is not None: summary = summary.get("value") start = comp.get("start") if start is not None: start = start.get("value") end = comp.get("end") if end is not None: end = end.get("value") rows.append((summary, start, end)) finally: store.Quit() rows.sort() print table.format_table(cols, rows)