Git Product home page Git Product logo

osx-callhistory-decryptor's Introduction

MacOS X Call history decryptor/converter to CSV

Build Status

ℹ PLEASE NOTE

since macOS 13 (Ventura) the Call History database appears to be not encrypted. You can run the program with -no-key flag to view the call history. The -k flag is no longer required, but still available for earlier versions of macOS.

Converts the MacOS X call history to CSV file format.

This is the Golang implementation of the n0fates' Call History Decryptor, and is based on n0fate's presentation descibing the internals of the database: https://papers.put.as/papers/macosx/2014/Forensic-artifacts-for-Yosemite-call-history-and-sms-anlaysis-ENG.pdf

Motivation for this implementation was:

  • to improve the usability by having just one binary executable;
  • increase the execution speed by using the standard library functions;
  • provide the convenient output format (CSV); and
  • describe the usage to make it more accessible to those who require getting the call history from MacOS X for any reason, but lacking the time or the technical knowledge required to set up the Python interpreter and packages needed for the ogirinal implementation.

All credit for the decryption logic goes to n0fate.

Purpose

Decrypt and save the macOS call history to a CSV file.

Download

Downloads are available on the Releases page.

How this works

The program creates a copy of the original database in a temporary directory and operates on that copy. After the Call History has been printed out, the temporary file is deleted.

The original database is not changed during the execution.

For reference: macOS stores the Call History data in the following location:

"$HOME/Library/Application Support/CallHistoryDB/CallHistory.storedata"

Usage

Start the program with -h command line flag to see the usage help.

Simple usage:

$ ./osx-callhistory-decryptor [flags] [database_file]

Where database_file is optional os macOS (on Windows you'd have to provide the filename).

macOS

Open the Terminal.app. (How?)

  1. Start the call history decryptor:

     $ ./osx-callhistory-decryptor
    

    It will try to locate the default call history file, make a temporary copy and open it.

    If you get the "Operation not permitted" on latest MacOSes:

    1. Go into "System Preferences";
    2. Choose "Security and Privacy";
    3. Go to "Privacy" tab, select "Full Disk Access" item;
    4. Add the Utilities/Terminal.app — or whatever you're using — to the list.
  2. You will be prompted for your user's logon password - this allows the program to fetch the callhistory encryption key from the OS X keychain. You can also provide the call history encryption key manually using the -k command line flag. Example:

     $ ./osx-callhistory-decryptor -k YSBzZWNyZXQga2V5IDEyCg==
    
  3. The output will be printed onto the terminal by default. You can specify an output file by providing the -o command line flag:

     $ ./osx-callhistory-decryptor -o output.csv
    

Opening a database from a non-default location

If, for any reason, you wish to open a different file than the default, the first command line parameter should contain the filename location:

$ ./osx-callhistory-decryptor -o output.csv Calls.db

Specifying the custom time format

By default the time format is RFC3339 without the "T" time/date separator ("2006-01-02 15:04:05Z07:00"). Optionally, one can change that behaviour with the -time-format flag by passing a different format. For example, if is is required to have just a date and time, invoke program like so:

$ ./osx-callhistory-decryptor -time-format="2006-01-02 15:04"

The formatting is described in depth in the Go time package documentation.

Linux, Windows, etc.

You will need to obtain the database and the encryption key from the original macOS system.

  1. Get the copy of the CallHistory.storedata from source OS X machine. The file is stored in this location:

     $HOME/Library/Application Support/CallHistoryDB/CallHistory.storedata
    

    with $HOME being the user's home directory.

    Copy it to the same directory where you've unpacked the 'callhistory'

  2. Get the key from the source macOS X keychain:

    1. search the macOS X keychain for the Call History User Data Key
    2. double-click the entry, and put the checkmark opposite the "show password" field.
    3. Enter your user's account password and copy the key value to the clipboard.
  3. Open the terminal or cmd.exe prompt on Windows (How?). Start the callhistory decryptor on your machine:

     C:>osx-callhistory-decryptor.exe -k <key value from step 2> <filename from step 1>
    
  4. The output will be printed onto the terminal by default. You can specify an output file by providing the -o command line flag:

     C:>osx-callhistory-decryptor.exe -o your_ex_callhistory_lol.csv <filename from step 1>
    

Licence

OS X Call history decryptor

Copyright (C) 2016 n0fate (GPL2 license)

Copyright (C) 2018-2021 rusq (golang implementation, GPL3)

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.

osx-callhistory-decryptor's People

Contributors

hensapir avatar rusq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

hensapir

osx-callhistory-decryptor's Issues

key changed, this no longer works...

macos 13.0.1

./osx-callhistory-decryptor
MacOS X Call History Decryptor v.0.0-development © 2018-2021 rusq
Based on Call History Decryptor © 2016 n0fate
2023/01/21 10:07:33 *** database filename: "/Users/x/Library/Application Support/CallHistoryDB/CallHistory.storedata"
2023/01/21 10:07:33 *** temporary file (will be removed): "/var/folders/nn/pztg8p51689c1xx06wv2zdg40000gn/T/callhistory198174384"
Enter your account password to access keychain when prompted...
2023/01/21 10:07:33 key is not supplied: make sure you have supplied the key via -k or KEY env variable

I checked in keychain but didnt find a callhistory key

Slice bounds out of range when running

👍 Opposed to the old Python script, this program does indeed run :)

I get an exception parsing the stuff, though:

panic: runtime error: slice bounds out of range [:32] with capacity 24

goroutine 1 [running]:
github.com/rusq/osx-callhistory-decryptor/historydecryptor.Decipher({0x1400001e198?, 0x14?, 0x6?}, {0x1400001e120?, 0x126?, 0x0?})
	/Users/xxx/Downloads/osx-callhistory-decryptor/historydecryptor/historydecryptor.go:130 +0x210
github.com/rusq/osx-callhistory-decryptor/historydecryptor.DecipherHistory({0x14000018190, 0x46}, {0x1400001e120, 0x10, 0x12}, {0x10474f3f8?, 0x14000010018}, {0x14000127e90, 0x1, 0x1045743f4?})
	/Users/xxx/Downloads/osx-callhistory-decryptor/historydecryptor/historydecryptor.go:108 +0x5dc
main.run({0x140000180a0, 0x4a}, {0x0, 0x0}, {0x16b94b6c2, 0x18})
	/Users/xxx/Downloads/osx-callhistory-decryptor/main.go:106 +0x2cc
main.main()
	/Users/xxx/Downloads/osx-callhistory-decryptor/main.go:77 +0x138
exit status 2

Tried with interactive Keychain Access prompt, and using the -k parameter. Same error in both cases.

Key param not working

Hi, when I try to use the key param, I get the following error:

MacOS X Call History Decryptor v.0.0-development © 2018-2021 rusq
Based on Call History Decryptor © 2016 n0fate
2021/04/04 20:04:31 *** database filename: "/Users/tf/Library/Application Support/CallHistoryDB/CallHistory.storedata"
2021/04/04 20:04:31 *** temporary file (will be removed): "/var/folders/d5/7nrdxk_x3hsd1p4bk2bttf640000gn/T/callhistory351382213"
2021/04/04 20:04:31 illegal base64 data at input byte 8: make sure you have supplied the key via -k or KEY env variable
exit status 1

The call looks like this:

go run . -k 2258D460-

Any idea what might be causing this? There's only one key available from MacOS Keychain.

Does not work under MacOS 11.1

./callhistory 
MacOS X Call History Decryptor  © 2018 rusq
Based on Call History Decryptor © 2016 n0fate
Enter your account password to access keychain when prompted...
2021/02/26 11:33:40 *** filename: CallHistory.storedata
2021/02/26 11:33:40 no such table: ZCALLRECORD

Producing an empty CSV file

When I run:

go run callhistory.go -o ~/Desktop/output-file.csv -f ../../../../data/calls/CallHistory.storedata

The terminal prints the CSV and a CSV file is generated. However, the generated file is empty.

Using version 1.1.1

Syntax Error

I'm getting this error:

sql: Scan error on column index 0, name "ZDATE": converting driver.Value type time.Time ("1990-07-23 01:31:02 +0000 UTC") to a float64: invalid syntax

The script runs and exports until it hits this row and then terminates without skipping or continuing.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.