-
Notifications
You must be signed in to change notification settings - Fork 2
/
quickstart.py
47 lines (39 loc) · 1.37 KB
/
quickstart.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
'''
Copyright (c) 2019 Jack Farley
This file is part of pymobiledevice2
Usage or distribution of this software/code is subject to the
terms of the GNU GENERAL PUBLIC LICENSE.
quickstart.py
Quickstart python script leveraging the fantastic work of IOSForensics/pymobiledevice's work
'''
from usbmux.usbmux import USBMux
from lockdown import LockdownClient
from afc import AFCShell, AFC2Client
import logging
import sys
def set_logger(log_level):
if log_level == 1:
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
datefmt='%m-%d %H:%M')
log = logging.getLogger()
return log
if log_level == 0:
logging.basicConfig(level=logging.INFO,
format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
datefmt='%m-%d %H:%M')
log = logging.getLogger()
return log
else:
print("Not a valid logging type. Use 0 for INFO and 1 for DEBUG. Default is INFO")
sys.exit()
def get_serial(log):
log.info("Starting USBMux")
mux = USBMux()
if not mux.devices:
mux.process(0.1)
serial_number = mux.devices[0].serial
return serial_number
def quickAfc(log_level = 0):
log = set_logger(log_level)
serial_number = get_serial(log)