Пример #1
0
def two_factor_authentication(email):
    try:
        auth_code = input(
            style.YELLOW('[+]') + style.RESET(
                f' Enter two factor authentication token sent to {email}: '))
        return auth_code
    except KeyboardInterrupt:
        print(u"{}[2J{}[;H".format(chr(27), chr(27)))
        print(style.RED('\n[!]') + style.RESET(' Error: User exit.'))
        print(style.GREEN('[+]') + style.RESET(' Thank you for using PyRing.'))
        print(style.GREEN('[+]') + style.RESET(' Author: Pr0xy07'))
        print(
            style.GREEN('[+]') +
            style.RESET(' If you need any help, contact: [email protected]')
        )
        sys.exit(0)
    except:
        print(u"{}[2J{}[;H".format(chr(27), chr(27)))
        print(
            style.RED('\n[!]') +
            style.RESET(' Error: Connot verify the authentication token.'))
        print(style.GREEN('[+]') + style.RESET(' Thank you for using PyRing.'))
        print(style.GREEN('[+]') + style.RESET(' Author: Pr0xy07'))
        print(
            style.GREEN('[+]') +
            style.RESET(' If you need any help, contact: [email protected]')
        )
        sys.exit(0)
Пример #2
0
def py_ring():
    get_access_token()
    ring = Ring(get_access_token.auth)
    ring.update_data()
    devices = ring.devices()
    get_doorbell_cam_motion2(devices)
    sys.exit(0)
    while True:
        if os.path.isdir('Recordings'):
            None
        else:
            os.mkdir('Recordings')
        print(u"{}[2J{}[;H".format(chr(27), chr(27)))

        get_access_token()
        print(u"{}[2J{}[;H".format(chr(27), chr(27)))
        print('   --- PyRing Main Menu ---   \n')
        print(style.GREEN('[01]') + style.RESET(' Ring devices.'))
        print(style.GREEN('[02]') + style.RESET(' Ring devices status.'))
        print(style.GREEN('[03]') + style.RESET(' Ring light control.'))
        print(style.GREEN('[04]') + style.RESET(' Ring motion alerts.'))
        print(
            style.GREEN('[05]') +
            style.RESET(' Download Ring latest motion video.'))
        print(style.GREEN('[06]') + style.RESET(' Download a month of video.'))
        print(style.GREEN('[99]') + style.RESET(' Exit PyRing.'))

        try:
            option = input(
                style.YELLOW('\n[+]') +
                style.RESET(' Choose your option [Eg: 01]: '))
        except KeyboardInterrupt:
            print(u"{}[2J{}[;H".format(chr(27), chr(27)))
            print(style.RED('\n[!]') + style.RESET(' Error: User exit.'))
            print(
                style.GREEN('[+]') +
                style.RESET(' Thank you for using PyRing.'))
            print(style.GREEN('[+]') + style.RESET(' Author: Pr0xy07'))
            print(
                style.GREEN('[+]') + style.RESET(
                    ' If you need any help, contact: [email protected]'))
            sys.exit(0)
        try:
            ring = Ring(get_access_token.auth)
            ring.update_data()
            devices = ring.devices()
        except:
            print(u"{}[2J{}[;H".format(chr(27), chr(27)))
            print(style.RED('\n[!]') + style.RESET(' Error: User exit.'))
            print(
                style.GREEN('[+]') +
                style.RESET(' Thank you for using PyRing.'))
            print(style.GREEN('[+]') + style.RESET(' Author: Pr0xy07'))
            print(
                style.GREEN('[+]') + style.RESET(
                    ' If you need any help, contact: [email protected]'))
            sys.exit(0)

        if option == "01":
            print(u"{}[2J{}[;H".format(chr(27), chr(27)))
            get_devices(devices)
        elif option == "02":
            print(u"{}[2J{}[;H".format(chr(27), chr(27)))
            get_status(devices)
        elif option == "03":
            light_control(devices)
        elif option == "04":
            get_alerts(devices)
        elif option == "05":
            get_motions(devices)
        elif option == "06":
            get_doorbell_cam_motion2(devices)
        elif option == "99":
            print(u"{}[2J{}[;H".format(chr(27), chr(27)))
            print(
                style.GREEN('\n[+]') +
                style.RESET(' Thank you for using PyRing.'))
            print(style.GREEN('[+]') + style.RESET(' Author: Pr0xy07'))
            print(
                style.GREEN('[+]') + style.RESET(
                    ' If you need any help, contact: [email protected]'))
            break
Пример #3
0
def get_access_token():
    auth = Auth("PyRing/1.0.0", None, update_token)

    if not os.path.exists(token_file):
        try:
            print('   --- Get Ring Access Token ---   \n')
            try:
                email = str(
                    input(style.YELLOW('[+]') + style.RESET(f' Ring Email: ')))
            except KeyboardInterrupt:
                print(u"{}[2J{}[;H".format(chr(27), chr(27)))
                print(style.RED('\n[!]') + style.RESET(' Error: User exit.'))
                print(
                    style.GREEN('[+]') +
                    style.RESET(' Thank you for using PyRing.'))
                print(style.GREEN('[+]') + style.RESET(' Author: Pr0xy07'))
                print(
                    style.GREEN('[+]') + style.RESET(
                        ' If you need any help, contact: [email protected]')
                )
                sys.exit(0)

            try:
                password = str(
                    getpass.getpass(
                        style.YELLOW('[+]') +
                        style.RESET(f' Ring Password: '******'\n[!]') + style.RESET(' Error: User exit.'))
                print(
                    style.GREEN('[+]') +
                    style.RESET(' Thank you for using PyRing.'))
                print(style.GREEN('[+]') + style.RESET(' Author: Pr0xy07'))
                print(
                    style.GREEN('[+]') + style.RESET(
                        ' If you need any help, contact: [email protected]')
                )
                sys.exit(0)

            auth.fetch_token(email, password)
            get_access_token.auth = Auth("PyRing/1.0.0",
                                         json.loads(token_file.read_text()),
                                         update_token)

        except MissingTokenError:
            auth.fetch_token(email, password, two_factor_authentication(email))
            get_access_token.auth = Auth("PyRing/1.0.0",
                                         json.loads(token_file.read_text()),
                                         update_token)
        except:
            print(u"{}[2J{}[;H".format(chr(27), chr(27)))
            print(
                style.RED('\n[!]') + style.RESET(
                    ' Cannot log in with the provided credentials, exiting...')
            )
            print(
                style.GREEN('[+]') +
                style.RESET(' Thank you for using PyRing.'))
            print(style.GREEN('[+]') + style.RESET(' Author: Pr0xy07'))
            print(
                style.GREEN('[+]') + style.RESET(
                    ' If you need any help, contact: [email protected]'))
            sys.exit(0)
    else:
        get_access_token.auth = Auth("PyRing/1.0.0",
                                     json.loads(token_file.read_text()),
                                     update_token)
Пример #4
0
def get_status(devices):
    try:
        print('   --- All Ring Devices Status ---   ')
        print(style.GREEN('\n[+]') + style.RESET(' Ring Stickup Cameras:'))
        if devices['stickup_cams']:
            for stickup_cam in devices['stickup_cams']:
                stickup_cam.update_health_data()
                print(style.YELLOW('    [-]') + style.RESET(str(stickup_cam)))
                print(
                    style.CYAN('         [*]') +
                    style.RESET(f' Device address: {stickup_cam.address}'))
                print(
                    style.CYAN('         [*]') +
                    style.RESET(f' Device ID: {stickup_cam.id}'))
                print(
                    style.CYAN('         [*]') +
                    style.RESET(f' Device type: {stickup_cam.family}'))
                print(
                    style.CYAN('         [*]') + style.RESET(
                        f' Device current battery life: {stickup_cam.battery_life}'
                    ))
                print(
                    style.CYAN('         [*]') +
                    style.RESET(f' Device timezone: {stickup_cam.timezone}'))
                print(
                    style.CYAN('         [*]') +
                    style.RESET(f' Device WiFi name: {stickup_cam.wifi_name}'))
                print(
                    style.CYAN('         [*]') + style.RESET(
                        f' Device WiFi strength: {stickup_cam.wifi_signal_strength}\n'
                    ))
        else:
            print(
                style.RED('   [!]') +
                style.RESET(' Error: Cannot find any stickup cameras.'))

        print(style.GREEN('\n[+]') + style.RESET(' Ring Doorbells:'))
        if devices['doorbots']:
            for doorbell in devices['doorbots']:
                doorbell.update_health_data()
                print(style.YELLOW('    [-]') + style.RESET(str(doorbell)))
                print(
                    style.CYAN('         [*]') +
                    style.RESET(f' Device address: {doorbell.address}'))
                print(
                    style.CYAN('         [*]') +
                    style.RESET(f' Device ID: {doorbell.id}'))
                print(
                    style.CYAN('         [*]') +
                    style.RESET(f' Device type: {doorbell.family}'))
                print(
                    style.CYAN('         [*]') + style.RESET(
                        f' Device current battery life: {doorbell.battery_life}'
                    ))
                print(
                    style.CYAN('         [*]') +
                    style.RESET(f' Device timezone: {doorbell.timezone}'))
                print(
                    style.CYAN('         [*]') +
                    style.RESET(f' Device WiFi name: {doorbell.wifi_name}'))
                print(
                    style.CYAN('         [*]') + style.RESET(
                        f' Device WiFi strength: {doorbell.wifi_signal_strength}\n'
                    ))
        else:
            print(
                style.RED('   [!]') +
                style.RESET(' Error: Cannot find any doorbells.'))

        print(style.GREEN('\n[+]') + style.RESET(' Ring Chimes:'))
        if devices['chimes']:
            for chime in devices['chimes']:
                chime.update_health_data()
                print(style.YELLOW('    [-]') + style.RESET(str(chime)))
                print(
                    style.CYAN('         [*]') +
                    style.RESET(f' Device address: {chime.address}'))
                print(
                    style.CYAN('         [*]') +
                    style.RESET(f' Device ID: {chime.id}'))
                print(
                    style.CYAN('         [*]') +
                    style.RESET(f' Device type: {chime.family}'))
                print(
                    style.CYAN('         [*]') + style.RESET(
                        f' Device current battery life: {chime.battery_life}'))
                print(
                    style.CYAN('         [*]') +
                    style.RESET(f' Device timezone: {chime.timezone}'))
                print(
                    style.CYAN('         [*]') +
                    style.RESET(f' Device WiFi name: {chime.wifi_name}'))
                print(
                    style.CYAN('         [*]') + style.RESET(
                        f' Device WiFi strength: {chime.wifi_signal_strength}\n'
                    ))
        else:
            print(
                style.RED('   [!]') +
                style.RESET(' Error: Cannot find any chimes.'))
        input(
            style.YELLOW('\n[*]') +
            style.RESET(' Press any key to return to PyRing main menu.'))
    except KeyboardInterrupt:
        print(u"{}[2J{}[;H".format(chr(27), chr(27)))
        print(style.RED('\n[!]') + style.RESET(' Error: User exit.'))
        print(style.GREEN('[+]') + style.RESET(' Thank you for using PyRing.'))
        print(style.GREEN('[+]') + style.RESET(' Author: Pr0xy07'))
        print(
            style.GREEN('[+]') +
            style.RESET(' If you need any help, contact: [email protected]')
        )
        sys.exit(0)
Пример #5
0
def light_control(devices):
    while True:
        print(u"{}[2J{}[;H".format(chr(27), chr(27)))
        print('   --- All Ring Devices Status ---   ')
        print(
            style.YELLOW('\n[*]') + style.RESET(
                ' This will only work with stickup cameras supporting light control.\n'
            ))
        print(
            style.GREEN('[01]') +
            style.RESET(' Ring stickup camera lights on.'))
        print(
            style.GREEN('[02]') +
            style.RESET(' Ring stickup camera lights off.'))
        print(style.GREEN('[99]') + style.RESET(' PyRing main menu.'))

        try:
            option = input(
                style.YELLOW('\n[+]') +
                style.RESET(' Choose your option [Eg: 01]: '))
        except KeyboardInterrupt:
            print(u"{}[2J{}[;H".format(chr(27), chr(27)))
            print(style.RED('\n[!]') + style.RESET(' Error: User exit.'))
            print(
                style.GREEN('[+]') +
                style.RESET(' Thank you for using PyRing.'))
            print(style.GREEN('[+]') + style.RESET(' Author: Pr0xy07'))
            print(
                style.GREEN('[+]') + style.RESET(
                    ' If you need any help, contact: [email protected]'))
            sys.exit(0)

        if option == "01":
            lights_on(devices)
        elif option == "02":
            lights_off(devices)
        elif option == "03":
            break
        elif option == "99":
            print(u"{}[2J{}[;H".format(chr(27), chr(27)))
            print(
                style.GREEN('\n[+]') +
                style.RESET(' Thank you for using PyRing.'))
            print(style.GREEN('[+]') + style.RESET(' Author: Pr0xy07'))
            print(
                style.GREEN('[+]') + style.RESET(
                    ' If you need any help, contact: [email protected]'))
            break
        else:
            print(u"{}[2J{}[;H".format(chr(27), chr(27)))
            print(style.RED('\n[!]') + style.RESET(' Error: Wrong input.'))
            print(
                style.GREEN('[+]') +
                style.RESET(' Thank you for using PyRing.'))
            print(style.GREEN('[+]') + style.RESET(' Author: Pr0xy07'))
            print(
                style.GREEN('[+]') + style.RESET(
                    ' If you need any help, contact: [email protected]'))
            sys.exit(0)
Пример #6
0
def lights_off(devices):
    print(u"{}[2J{}[;H".format(chr(27), chr(27)))
    available_cams = []
    count = 1
    for stickup_cam in list(devices['stickup_cams']):
        if stickup_cam.lights:
            available_cams.append(stickup_cam)
            for cam in available_cams:
                print(style.GREEN(f'[{count}]') + style.RESET(f' {cam}'))
                count += 1
            try:
                option = input(
                    style.YELLOW('\n[+]') +
                    style.RESET(' Choose your camera [Eg: 1]: '))
                option = int(option) - 1
                if option > len(available_cams):
                    print(u"{}[2J{}[;H".format(chr(27), chr(27)))
                    print(
                        style.RED('\n[!]') +
                        style.RESET(' Error: Wrong input.'))
                    print(
                        style.GREEN('[+]') +
                        style.RESET(' Thank you for using PyRing.'))
                    print(style.GREEN('[+]') + style.RESET(' Author: Pr0xy07'))
                    print(
                        style.GREEN('[+]') + style.RESET(
                            ' If you need any help, contact: [email protected]'
                        ))
                    sys.exit(0)
                else:
                    available_cams[option].update_health_data()
                    available_cams[option].lights = 'off'
                    print(
                        style.GREEN('[+]') + style.RESET(
                            f' Turned off {available_cams[option]} lights successfully.'
                        ))
                    input(
                        style.YELLOW('\n[*]') + style.RESET(
                            ' Press any key to return to PyRing light control menu.'
                        ))
            except KeyboardInterrupt:
                print(u"{}[2J{}[;H".format(chr(27), chr(27)))
                print(style.RED('\n[!]') + style.RESET(' Error: User exit.'))
                print(
                    style.GREEN('[+]') +
                    style.RESET(' Thank you for using PyRing.'))
                print(style.GREEN('[+]') + style.RESET(' Author: Pr0xy07'))
                print(
                    style.GREEN('[+]') + style.RESET(
                        ' If you need any help, contact: [email protected]')
                )
                sys.exit(0)
Пример #7
0
def get_doorbell_cam_motion(devices):
    while True:
        print(u"{}[2J{}[;H".format(chr(27), chr(27)))
        print('   --- Ring Doorbell Cameras Motion Alerts ---   \n')

        count = 1

        if devices['doorbots']:
            for doorbell in devices['doorbots']:
                print(
                    style.GREEN(f'[0{count}]') + style.RESET(f' {doorbell}.'))
                count += 1
            print(
                style.GREEN(f'[99]') +
                style.RESET(' Return to motion alerts menu.'))

            try:
                option_ = input(
                    style.YELLOW('\n[+]') +
                    style.RESET(' Choose your option [Eg: 01]: '))
            except KeyboardInterrupt:
                print(u"{}[2J{}[;H".format(chr(27), chr(27)))
                print(style.RED('\n[!]') + style.RESET(' Error: User exit.'))
                print(
                    style.GREEN('[+]') +
                    style.RESET(' Thank you for using PyRing.'))
                print(style.GREEN('[+]') + style.RESET(' Author: Pr0xy07'))
                print(
                    style.GREEN('[+]') + style.RESET(
                        ' If you need any help, contact: [email protected]')
                )
                sys.exit(0)

            if option_ == "99":
                print(u"{}[2J{}[;H".format(chr(27), chr(27)))
                print(
                    style.GREEN('\n[+]') +
                    style.RESET(' Thank you for using PyRing.'))
                print(style.GREEN('[+]') + style.RESET(' Author: Pr0xy07'))
                print(
                    style.GREEN('[+]') + style.RESET(
                        ' If you need any help, contact: [email protected]')
                )
                break
            else:
                option_ = int(option_) - 1
                current_cam = devices['doorbots'][option_]

            recording_cam_name = re.sub('[^a-zA-Z]+', '', str(current_cam))
            print(current_cam)

            for event in current_cam.history(limit=1000,
                                             enforce_limit=True,
                                             retry=10):
                print(event['created_at'])

                if event['created_at'].month == 11:
                    motion_time = str(event['created_at']).replace(':', '-')
                    id_to_get = event['id']

                    print(
                        style.YELLOW('\n[*]') + style.RESET(
                            f' Downloading {current_cam} motion video...'))
                    # mp4_download = current_cam.recording_download(
                    #          id_to_get,
                    #          filename = f'Recordings/{recording_cam_name} - {motion_time}.mp4', override=True)
                    # if mp4_download:
                    #     print(style.GREEN('[+]') + style.RESET(f' Downlaoded footage from {current_cam} at {motion_time}'))
                    # else:
                    #     None
                    # print(style.YELLOW('\n[*]') + style.RESET(f' Generating recording video URL...'))
                    # recording_url = current_cam.recording_url(current_cam.last_recording_id)
                    # if mp4_download:
                    #     print(style.GREEN('[+]') + style.RESET(f' Recording full URL: {recording_url}'))
                    # else:
                    #     None

            input(
                style.YELLOW('\n[*]') +
                style.RESET(' Press any key to return to devices list.'))

        else:
            print(
                style.RED('   [!]') +
                style.RESET(' Error: Cannot find any doorbell cameras.'))
            input(
                style.YELLOW('\n[*]') +
                style.RESET(' Press any key to return to devices list.'))
            break
Пример #8
0
def get_stickup_cam_motion(devices):
    while True:
        print(u"{}[2J{}[;H".format(chr(27), chr(27)))
        print('   --- Ring Stickup Cameras Motion Alerts ---   \n')

        count = 1

        if devices['stickup_cams']:
            for stickup_cam in devices['stickup_cams']:
                print(
                    style.GREEN(f'[0{count}]') +
                    style.RESET(f' {stickup_cam}.'))
                count += 1
            print(
                style.GREEN(f'[99]') +
                style.RESET(' Return to motion alerts menu.'))

            try:
                option_ = input(
                    style.YELLOW('\n[+]') +
                    style.RESET(' Choose your option [Eg: 01]: '))
            except KeyboardInterrupt:
                print(u"{}[2J{}[;H".format(chr(27), chr(27)))
                print(style.RED('\n[!]') + style.RESET(' Error: User exit.'))
                print(
                    style.GREEN('[+]') +
                    style.RESET(' Thank you for using PyRing.'))
                print(style.GREEN('[+]') + style.RESET(' Author: Pr0xy07'))
                print(
                    style.GREEN('[+]') + style.RESET(
                        ' If you need any help, contact: [email protected]')
                )
                sys.exit(0)

            if option_ == "99":
                print(u"{}[2J{}[;H".format(chr(27), chr(27)))
                print(
                    style.GREEN('\n[+]') +
                    style.RESET(' Thank you for using PyRing.'))
                print(style.GREEN('[+]') + style.RESET(' Author: Pr0xy07'))
                print(
                    style.GREEN('[+]') + style.RESET(
                        ' If you need any help, contact: [email protected]')
                )
                break
            else:
                option_ = int(option_) - 1
                current_cam = devices['stickup_cams'][option_]

            for event in current_cam.history(limit=1):
                motion_time = str(event['created_at']).replace(':', '-')

            print(
                style.YELLOW('\n[*]') +
                style.RESET(f' Downloading {current_cam} motion video...'))
            recording_cam_name = re.sub('[^a-zA-Z]+', '', str(current_cam))
            mp4_download = current_cam.recording_download(
                current_cam.history(limit=100, kind='motion')[0]['id'],
                filename=f'Recordings/{recording_cam_name} - {motion_time}.mp4',
                override=True)
            if mp4_download:
                print(
                    style.GREEN('[+]') + style.RESET(
                        f' Downlaoded latest footage from {current_cam}'))
            else:
                None
            print(
                style.YELLOW('\n[*]') +
                style.RESET(f' Generating recording video URL...'))
            recording_url = current_cam.recording_url(
                current_cam.last_recording_id)
            if mp4_download:
                print(
                    style.GREEN('[+]') +
                    style.RESET(f' Recording full URL: {recording_url}'))
            else:
                None

            input(
                style.YELLOW('\n[*]') +
                style.RESET(' Press any key to return to devices list.'))
        else:
            print(
                style.RED('   [!]') +
                style.RESET(' Error: Cannot find any stickup cameras.'))
            input(
                style.YELLOW('\n[*]') +
                style.RESET(' Press any key to return to devices list.'))
            break
Пример #9
0
def get_motions(devices):
    while True:
        print(u"{}[2J{}[;H".format(chr(27), chr(27)))
        print('   --- Ring Motion Alerts ---   \n')
        print(
            style.GREEN('[01]') +
            style.RESET(' Ring stickup camera motion video.'))
        print(
            style.GREEN('[02]') +
            style.RESET(' Ring doorbell camera motion video..'))
        print(style.GREEN('[99]') + style.RESET(' PyRing main menu.'))

        try:
            option = input(
                style.YELLOW('\n[+]') +
                style.RESET(' Choose your option [Eg: 01]: '))
        except KeyboardInterrupt:
            print(u"{}[2J{}[;H".format(chr(27), chr(27)))
            print(style.RED('\n[!]') + style.RESET(' Error: User exit.'))
            print(
                style.GREEN('[+]') +
                style.RESET(' Thank you for using PyRing.'))
            print(style.GREEN('[+]') + style.RESET(' Author: Pr0xy07'))
            print(
                style.GREEN('[+]') + style.RESET(
                    ' If you need any help, contact: [email protected]'))
            sys.exit(0)

        if option == "01":
            get_stickup_cam_motion(devices)
        elif option == "02":
            get_doorbell_cam_motion(devices)
        elif option == "99":
            print(u"{}[2J{}[;H".format(chr(27), chr(27)))
            print(
                style.GREEN('\n[+]') +
                style.RESET(' Thank you for using PyRing.'))
            print(style.GREEN('[+]') + style.RESET(' Author: Pr0xy07'))
            print(
                style.GREEN('[+]') + style.RESET(
                    ' If you need any help, contact: [email protected]'))
            break
Пример #10
0
def get_alerts(devices):
    try:
        print(u"{}[2J{}[;H".format(chr(27), chr(27)))
        print('   --- All Ring Devices Motion Alerts ---   \n')

        try:
            motion_limit = int(
                input(
                    style.GREEN('[+]') + style.RESET(
                        ' How many latest motion alerts you want to get [EG: 3]: '
                    )))
        except KeyboardInterrupt:
            print(u"{}[2J{}[;H".format(chr(27), chr(27)))
            print(style.RED('\n[!]') + style.RESET(' Error: User exit.'))
            print(
                style.GREEN('[+]') +
                style.RESET(' Thank you for using PyRing.'))
            print(style.GREEN('[+]') + style.RESET(' Author: Pr0xy07'))
            print(
                style.GREEN('[+]') + style.RESET(
                    ' If you need any help, contact: [email protected]'))
            sys.exit(0)
        except:
            print(u"{}[2J{}[;H".format(chr(27), chr(27)))
            print(style.RED('\n[!]') + style.RESET(' Error: Wrong Input.'))
            print(
                style.GREEN('[+]') +
                style.RESET(' Thank you for using PyRing.'))
            print(style.GREEN('[+]') + style.RESET(' Author: Pr0xy07'))
            print(
                style.GREEN('[+]') + style.RESET(
                    ' If you need any help, contact: [email protected]'))
            sys.exit(0)

        print(style.GREEN('\n[+]') + style.RESET(' Ring Stickup Cameras:'))
        if devices['stickup_cams']:
            for stickup_cam in devices['stickup_cams']:
                print(
                    style.YELLOW('    \n[-]') + style.RESET(str(stickup_cam)))
                for event in stickup_cam.history(limit=motion_limit):
                    print(
                        style.CYAN('         [*]') +
                        style.RESET(f' Motion event ID: {event["id"]}'))
                    print(
                        style.CYAN('         [*]') +
                        style.RESET(f' Motion kind: {event["kind"]}'))
                    print(
                        style.CYAN('         [*]') +
                        style.RESET(f' Answered status: {event["answered"]}'))
                    print(
                        style.CYAN('         [*]') +
                        style.RESET(f' Motion time: {event["created_at"]}'))
                    print('-' * 50)
        else:
            print(
                style.RED('   [!]') +
                style.RESET(' Error: Cannot find any stickup cameras.'))

        print(style.GREEN('\n[+]') + style.RESET(' Ring Doorbell Cameras:'))
        if devices['doorbots']:
            for doorbell in devices['doorbots']:
                print(style.YELLOW('    \n[-]') + style.RESET(str(doorbell)))
                for event in doorbell.history(limit=motion_limit):
                    print(
                        style.CYAN('         [*]') +
                        style.RESET(f' Motion event ID: {event["id"]}'))
                    print(
                        style.CYAN('         [*]') +
                        style.RESET(f' Motion kind: {event["kind"]}'))
                    print(
                        style.CYAN('         [*]') +
                        style.RESET(f' Answered status: {event["answered"]}'))
                    print(
                        style.CYAN('         [*]') +
                        style.RESET(f' Motion time: {event["created_at"]}'))
                    print('-' * 50)
        else:
            print(
                style.RED('   [!]') +
                style.RESET(' Error: Cannot find any doorbell cameras.'))

        input(
            style.YELLOW('\n[*]') +
            style.RESET(' Press any key to return to PyRing main menu.'))
    except KeyboardInterrupt:
        print(u"{}[2J{}[;H".format(chr(27), chr(27)))
        print(style.RED('\n[!]') + style.RESET(' Error: User exit.'))
        print(style.GREEN('[+]') + style.RESET(' Thank you for using PyRing.'))
        print(style.GREEN('[+]') + style.RESET(' Author: Pr0xy07'))
        print(
            style.GREEN('[+]') +
            style.RESET(' If you need any help, contact: [email protected]')
        )
        sys.exit(0)
Пример #11
0
def get_devices(devices):
    try:
        print('   --- All Ring Devices ---   ')

        print(style.GREEN('\n[+]') + style.RESET(' Ring Stickup Cameras:'))
        if devices['stickup_cams']:
            for stickup_cam in devices['stickup_cams']:
                print(style.YELLOW('    [-]') + style.RESET(str(stickup_cam)))
        else:
            print(
                style.RED('[!]') +
                style.RESET(' Error: Cannot find any stickup camera.'))

        print(style.GREEN('\n[+]') + style.RESET(' Ring Doorbells:'))
        if devices['doorbots']:
            for doorbell in devices['doorbots']:
                print(style.YELLOW('    [-]') + style.RESET(str(doorbell)))
        else:
            print(
                style.RED('   [!]') +
                style.RESET(' Error: Cannot find any doorbells.'))

        print(style.GREEN('\n[+]') + style.RESET(' Ring Chimes:'))
        if devices['chimes']:
            for chime in devices['chimes']:
                print(style.YELLOW('    [-]') + style.RESET(str(chime)))
        else:
            print(
                style.RED('   [!]') +
                style.RESET(' Error: Cannot find any chimes.'))

        input(
            style.YELLOW('\n[*]') +
            style.RESET(' Press any key to return to PyRing main menu.'))

    except KeyboardInterrupt:
        print(u"{}[2J{}[;H".format(chr(27), chr(27)))
        print(style.RED('\n[!]') + style.RESET(' Error: User exit.'))
        print(style.GREEN('[+]') + style.RESET(' Thank you for using PyRing.'))
        print(style.GREEN('[+]') + style.RESET(' Author: Pr0xy07'))
        print(
            style.GREEN('[+]') +
            style.RESET(' If you need any help, contact: [email protected]')
        )
        sys.exit(0)