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 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)