def main(argv):

    chat_session_list = []
    address_book_list = []
    global mode
    global PYTHON_VERSION

    # parser options
    parser = ArgumentParser(description='Converts a iOS SMS database to HTML.')
    parser.add_argument('-s',
                        '--smsdb',
                        dest='smsfile',
                        help="input 'SMS Database' (iPhone) file to scan")
    parser.add_argument(
        '-a',
        '--abdb',
        dest='abfile',
        help="input 'Addressbook Database' (iPhone) file to scan")
    parser.add_argument('-o',
                        '--outfile',
                        dest='outfile',
                        help="optionally choose name of output file")
    options = parser.parse_args()

    # checks for the input file
    if options.smsfile is None:
        parser.print_help()
        sys.exit(1)
    if not os.path.exists(options.smsfile):
        print('"{}" file is not found!'.format(options.smsfile))
        sys.exit(1)

    if options.abfile is not None:
        if not os.path.exists(options.abfile):
            print('"{}" file is not found!'.format(options.abfile))
        address_book_list = get_addressbook(options.abfile)

    # connects to the database(s)
    msgstore = sqlite3.connect(options.smsfile)
    msgstore.row_factory = sqlite3.Row
    c1 = msgstore.cursor()

    # check on platform
    mode = IPHONE
    print("iPhone mode!\n")

    chat_session_list = getChatSessions(c1, address_book_list)
    chat_session_list = getChatMessages(c1, chat_session_list)

    # OUTPUT
    if options.outfile is None:
        outfile = "SMS-Report"
    else:
        outfile = options.outfile

    printHTMLReport(outfile, chat_session_list)
    def __init__(self, addressbook=None, addressbookimages=None, work_dir=None):
        QtGui.QMainWindow.__init__(self)

        self.name = "contactsGUI"
        
        if work_dir is not None:
            self.work_dir = work_dir
        else:
            self.work_dir = makeTmpDir()

        self.ui = Ui_frmContacts()
        self.ui.setupUi(self)
        self.setAttribute(QtCore.Qt.WA_DeleteOnClose)

        QtCore.QObject.connect(self.ui.treeWidgetContacts, QtCore.SIGNAL("itemSelectionChanged()"), self.onTreeClick)
        QtCore.QObject.connect(self.ui.actionReport, QtCore.SIGNAL("triggered(bool)"), self.printReport)
        QtCore.QObject.connect(self.ui.actionExtract, QtCore.SIGNAL("triggered(bool)"), self.extractApp)

        self.ui.treeWidgetContacts.setHeaderLabel('Contacts')
        self.ui.treeWidgetContacts.setColumnHidden(1, False)
        self.ui.treeWidgetContacts.setColumnHidden(2, False)
        self.ui.treeWidgetContacts.setColumnHidden(3, False)
        self.ui.treeWidgetContacts.setColumnHidden(4, False)
        self.ui.treeWidgetContacts.setColumnHidden(5, False)
        self.ui.treeWidgetContacts.setColumnHidden(6, False)
        self.ui.treeWidgetContacts.setColumnHidden(7, False)
        self.ui.treeWidgetContacts.setColumnHidden(8, False)
        self.ui.treeWidgetContacts.setColumnHidden(9, False)

        self.address_book_list = get_addressbook(addressbook, addressbookimages)
        for contact in self.address_book_list:
            name = ""
            if contact.last_name != "" and contact.last_name is not None:
                name = contact.last_name
            if contact.first_name != "" and contact.first_name is not None:
                if name is not "":
                    name = name + ", " + contact.first_name
                else:
                    name = contact.first_name
            if name == "":
                name = contact.organization

            newItem = QtGui.QTreeWidgetItem(None)
            newItem.setText(0, name)
            newItem.setText(1, contact.rowid)
            newItem.setText(2, contact.last_name)
            newItem.setText(3, contact.first_name)
            newItem.setText(4, contact.organization)
            newItem.setText(5, str(contact.creation_date))
            newItem.setText(6, str(contact.modification_date))
            newItem.setText(7, str(contact.birthday))
            newItem.setText(8, contact.image_url)
            newItem.setText(9, str(contact.multivalue))
            self.ui.treeWidgetContacts.addTopLevelItem(newItem)
def main(argv):
    address_book_list = []
    global mode
    global PYTHON_VERSION
    global ADDRESSBOOKAVAILABLE
    global ADDRESSBOOKIMAGESAVAILABLE


    # parser options
    parser = ArgumentParser(description='Converts a Addressbook database to HTML.')
    parser.add_argument('-a', '--abdb', dest='abfile',
                        help="input 'Addressbook Database' (iPhone) file to scan")
    parser.add_argument('-p', '--picdb', dest='picfile',
                        help="input 'AddressbookImages Database' (iPhone) file to scan")
    parser.add_argument('-o', '--outfile', dest='outfile',
                        help="optionally choose name of output file")
    options = parser.parse_args()


    # checks for the input file

    if options.abfile is not None:
        if not os.path.exists(options.abfile):
            print('"{}" file is not found!'.format(options.abfile))
            sys.exit(1)

    if options.picfile is not None:
        if not os.path.exists(options.picfile):
            print('"{}" file is not found!'.format(options.picfile))
            sys.exit(1)
        else:
            picfile = options.picfile
    else:
        picfile = ""

    address_book_list = get_addressbook(options.abfile, picfile)

    # check on platform
    mode = IPHONE
    print ("iPhone mode!\n")

    # gets metadata plist info (iphone only)


    # OUTPUT
    if options.outfile is None:
        outfile = "AB-Report"
    else:
        outfile = options.outfile

    printHTMLReport(outfile, address_book_list)
def main(argv):

    chat_session_list = []
    address_book_list = []
    global mode
    global PYTHON_VERSION

    # parser options
    parser = ArgumentParser(description='Converts a iOS SMS database to HTML.')
    parser.add_argument('-s', '--smsdb', dest='smsfile',
                       help="input 'SMS Database' (iPhone) file to scan")
    parser.add_argument('-a', '--abdb', dest='abfile',
                        help="input 'Addressbook Database' (iPhone) file to scan")
    parser.add_argument('-o', '--outfile',  dest='outfile',
                       help="optionally choose name of output file")
    options = parser.parse_args()


    # checks for the input file
    if options.smsfile is None:
        parser.print_help()
        sys.exit(1)
    if not os.path.exists(options.smsfile):
        print('"{}" file is not found!'.format(options.smsfile))
        sys.exit(1)

    if options.abfile is not None:
        if not os.path.exists(options.abfile):
            print('"{}" file is not found!'.format(options.abfile))
        address_book_list = get_addressbook(options.abfile)

    # connects to the database(s)
    msgstore = sqlite3.connect(options.smsfile)
    msgstore.row_factory = sqlite3.Row
    c1 = msgstore.cursor()

    # check on platform
    mode = IPHONE
    print ("iPhone mode!\n")

    chat_session_list = getChatSessions(c1, address_book_list)
    chat_session_list = getChatMessages(c1, chat_session_list)


    # OUTPUT
    if options.outfile is None:
        outfile = "SMS-Report"
    else:
        outfile = options.outfile

    printHTMLReport(outfile,chat_session_list)
    def __init__(self, smsdb, abookdb=None, abimgdb=None):
        QtGui.QMainWindow.__init__(self)

        self.chat_session_list = []
        self.address_book_list = []

        if smsdb == None:
            self.smsdb = None
        else:
            self.smsdb = smsdb
        if abookdb == "" or abookdb is None:
            self.abookdb = None
        else:
            self.abookdb = abookdb
        if abimgdb == "" or abimgdb is None:
            self.abimgdb = None
        else:
            self.abimgdb = abimgdb

        self.ui = Ui_frmSMS()
        self.ui.setupUi(self)
        self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
        QtCore.QObject.connect(self.ui.tableViewChats,
                               QtCore.SIGNAL("itemSelectionChanged()"),
                               self.onTreeClick)
        QtCore.QObject.connect(self.ui.actionReport,
                               QtCore.SIGNAL("triggered(bool)"),
                               self.printReport)
        QtCore.QObject.connect(self.ui.actionExtract,
                               QtCore.SIGNAL("triggered(bool)"),
                               self.extractApp)

        if self.abookdb is not None:
            self.address_book_list = get_addressbook(self.abookdb,
                                                     self.abimgdb)

        msgstore = sqlite3.connect(self.smsdb)
        msgstore.row_factory = sqlite3.Row
        c1 = msgstore.cursor()

        self.chat_session_list = getChatSessions(c1, self.address_book_list)
        self.chat_session_list = getChatMessages(c1, self.chat_session_list)
        chatsmodel = ChatsTableModel(self.chat_session_list)
        self.ui.tableViewChats.setModel(chatsmodel)
        self.ui.tableViewChats.setSortingEnabled(True)
    def __init__(self, callhistorydb, abookdb=None, abimgdb=None):
        QtGui.QMainWindow.__init__(self)

        self.call_history_list = []
        self.address_book_list = []

        if callhistorydb == None:
            self.callhistorydb = None
        else:
            self.callhistorydb = callhistorydb

        if abimgdb == "" or abimgdb is None:
            self.abimgdb = None
        else:
            self.abimgdb = abimgdb

        if abookdb == "" or abookdb is None:
            self.abookdb = None
        else:
            self.abookdb = abookdb
            self.address_book_list = get_addressbook(self.abookdb, self.abimgdb)

        self.ui = Ui_frmCallHistory()
        self.ui.setupUi(self)
        self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
        QtCore.QObject.connect(self.ui.actionExtract, QtCore.SIGNAL("triggered(bool)"), self.extractApp)
        QtCore.QObject.connect(self.ui.actionReport, QtCore.SIGNAL("triggered(bool)"), self.printReport)

        mode = iOSCallHistoryVersion(self.callhistorydb)
        msgstore = sqlite3.connect(self.callhistorydb)
        msgstore.row_factory = sqlite3.Row
        c1 = msgstore.cursor()

        if mode == "" or mode is None or mode == "Unknown":
            QtGui.QMessageBox.information(self, "Information", "Unsupported iOS version...")
        elif mode == IPHONE_VERSION6:
            self.call_history_list = getCall_list(c1, self.address_book_list)
        elif mode == IPHONE_VERSION8:
            self.call_history_list = getCall_list8(c1, self.address_book_list)
        if self.call_history_list is None:
            QtGui.QMessageBox.information(self, "Information", "No calls found...")
        else:
            callsmodel = CallHistoryTableModel(self.call_history_list)
            self.ui.tableViewCalls.setModel(callsmodel)
    def __init__(self, smsdb, abookdb=None, abimgdb=None):
        QtGui.QMainWindow.__init__(self)

        self.chat_session_list = []
        self.address_book_list = []

        if smsdb == None:
            self.smsdb = None
        else:
            self.smsdb = smsdb
        if abookdb == "" or abookdb is None:
            self.abookdb = None
        else:
            self.abookdb = abookdb
        if abimgdb == "" or abimgdb is None:
            self.abimgdb = None
        else:
            self.abimgdb = abimgdb

        self.ui = Ui_frmSMS()
        self.ui.setupUi(self)
        self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
        QtCore.QObject.connect(self.ui.tableViewChats, QtCore.SIGNAL("itemSelectionChanged()"), self.onTreeClick)
        QtCore.QObject.connect(self.ui.actionReport, QtCore.SIGNAL("triggered(bool)"), self.printReport)
        QtCore.QObject.connect(self.ui.actionExtract, QtCore.SIGNAL("triggered(bool)"), self.extractApp)

        if self.abookdb is not None:
            self.address_book_list = get_addressbook(self.abookdb, self.abimgdb)

        msgstore = sqlite3.connect(self.smsdb)
        msgstore.row_factory = sqlite3.Row
        c1 = msgstore.cursor()

        self.chat_session_list = getChatSessions(c1, self.address_book_list)
        self.chat_session_list = getChatMessages(c1, self.chat_session_list)
        chatsmodel = ChatsTableModel(self.chat_session_list)
        self.ui.tableViewChats.setModel(chatsmodel)
        self.ui.tableViewChats.setSortingEnabled(True)
def main(argv):

    call_list = []
    address_book_list = []
    global mode
    global PYTHON_VERSION
    global ADDRESSBOOKAVAILABLE


    # parser options
    parser = ArgumentParser(description='Converts a iOS SMS database to HTML.')
    parser.add_argument('-i', '--callhistorydb', dest='callfile',
                       help="input 'SMS Database' (iPhone) file to scan")
    parser.add_argument('-a', '--abdb', dest='abfile',
                        help="input 'Addressbook Database' (iPhone) file to scan")
    parser.add_argument('-o', '--outfile',  dest='outfile',
                       help="optionally choose name of output file")
    options = parser.parse_args()


    # checks for the input file
    if options.callfile is None:
        parser.print_help()
        sys.exit(1)
    if not os.path.exists(options.callfile):
        print('"{}" file is not found!'.format(options.callfile))
        sys.exit(1)

    if options.abfile is not None:
        if not os.path.exists(options.abfile):
            print('"{}" file is not found!'.format(options.abfile))
            sys.exit(1)
        address_book_list = get_addressbook(options.abfile)

    # connects to the database(s)
    msgstore = sqlite3.connect(options.callfile)
    msgstore.row_factory = sqlite3.Row
    c1 = msgstore.cursor()

    mode = iOSCallHistoryVersion(options.callfile)

    print("IPhone mode is iOS %s" %mode)

    if mode == "" or mode is None or mode == "Unknown":
        print("Uknown mode ... exit...")
        sys.exit(1)

    if mode == IPHONE_VERSION6:
        call_list = getCall_list(c1, address_book_list)
    elif mode == IPHONE_VERSION8:
        call_list = getCall_list8(c1, address_book_list)
    else:
        print("Unknown version %s" %mode)
        sys.exit(1)
    if call_list is None:
        print("No calls available...")
        sys.exit(1)

    # OUTPUT
    if options.outfile is None:
        outfile = "CallHistory-Report"
    else:
        outfile = options.outfile

    printHTMLReport(outfile, call_list)