How to send iphonemessages with python

How to send iphonemessages with python


#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
__author__ = ' ay abdullahi'
__homepage__ = ' https://teachbang.com'
'''

import os
import sqlite3
import optparse


def isMessageTable(iphoneDB):
    try:
        conn = sqlite3.connect(iphoneDB)
        c = conn.cursor()
        c.execute('SELECT tbl_name FROM sqlite_master \
          WHERE type==\"table\";')
        for row in c:
            if 'message' in str(row):
                return True
    except:
        return False


def printMessage(msgDB):
    try:
        conn = sqlite3.connect(msgDB)
        c = conn.cursor()
        c.execute('select datetime(date,\'unixepoch\'),\
          address, text from message WHERE address>0;')
        for row in c:
            date = str(row[0])
            addr = str(row[1])
            text = row[2]
            print('\n[+] Date: '+date+', Addr: '+addr \
                + ' Message: ' + text)
    except:
        pass


def main():
    parser = optparse.OptionParser("usage %prog "+\
      "-p <iPhone Backup Directory> ")
    parser.add_option('-p', dest='pathName',\
      type='string',help='specify skype profile path')
    (options, args) = parser.parse_args()
    
    pathName = options.pathName
    if pathName == None:
        print(parser.usage())
        exit(0)
    else:
        dirList = os.listdir(pathName)
        for fileName in dirList:
            iphoneDB = os.path.join(pathName, fileName)
            if isMessageTable(iphoneDB):
                try:
                    print('\n[*] --- Found Messages ---')
                    print(Message(iphoneDB))
                except:
                    pass


if __name__ == '__main__':
    main()

About author
teachbang
teachbang
Admin @ TeachBang I’m passionate about building great products that make people’s lives easier. Experienced cyber security,ethical hacking,Machine Learning and Web development professional with over 3 years strategizing innovative digital industry experiences.
Comments
Do you want to get informed about new articles?

Related articles