Subversion Repositories kim

Rev

Rev 6 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 t00m 1
#!/usr/bin/env python
2
# -*- coding: utf-8 -*-
3
"""
4
# Author: Tomás Vírseda <tomasvirseda@gmail.com>
5
# Version: 0.1
6
# License: GPLv3
7
# Description: KIM (Keep In Mind) is a little script to extract visited
8
#              SAP Notes from webbrowsers (currently Firefox and Chrome)
9
# Docs
10
# Firefox: https://github.com/shadow-box/Violent-Python-Examples/blob/master/Chapter-3/6-firefoxParse.py
11
# Chrome: https://github.com/karthikeyankc/HistoryAnalyzer/blob/master/HistoryAnalyzer.py
12
# https://sandersonforensics.com/forum/content.php?205-Chrome-history-with-Recursive-Common-Table-Expressions
13
"""
14
 
6 t00m 15
import argparse
16
 
3 t00m 17
try:
18
    from .logger import Logger
19
    from .utils import *
20
    from .project import *
21
except:
22
    from logger import Logger
23
    from utils import Utils
24
    from project import *
1 t00m 25
 
6 t00m 26
 
27
def get_app_options():
28
    parser = argparse.ArgumentParser(description='%s by %s <%s>' % (name, author, author_email))
29
    #~ parser.add_argument('-a', '--all', action='all', help='Get SAP Notes from all browsers')
30
    #~ parser = parser.add_mutually_exclusive_group(required=False)
31
    #~ parser.add_argument('-f', '--firefox', action='store_true', dest='Firefox', help='Get SAP Notes from Firefox')
32
    #~ parser.add_argument('-c', '--chrome', dest='Chrome', help='Get SAP Notes from Chrome')
33
    parser.add_argument('-d',  '--debug',   dest='LOGLEVEL',    help='Increase output verbosity', action='store', default='INFO')
34
    parser.add_argument('-v', '--version', action='version', version='%s %s' % (name, version))
35
    params = parser.parse_args()
36
 
37
    return params
38
 
3 t00m 39
class KIM:
40
    snotes = set()
41
    dnotes = {}
42
    log = None
43
    utils = None
5 t00m 44
    options = None
1 t00m 45
 
3 t00m 46
    def __init__(self):
6 t00m 47
        self.options = get_app_options()
48
        self.utils = Utils(self.options)
49
        self.log = Logger('KIM', level=self.options.LOGLEVEL).get_logger()
7 t00m 50
        self.log.debug('Starting %s %s', name, version)
1 t00m 51
 
3 t00m 52
    def run(self):
5 t00m 53
        snff = self.utils.get_firefox_history()
54
        snch = self.utils.get_chrome_history()
6 t00m 55
        usndict = self.utils.get_uniq_sapnotes([snff, snch])
7 t00m 56
        self.log.debug("Total Unique SAP Notes: %d", len(usndict))
1 t00m 57
 
6 t00m 58
        return usndict
5 t00m 59
 
6 t00m 60
 
1 t00m 61
def main():
3 t00m 62
    kim = KIM()
7 t00m 63
    usndict = kim.run()
64
    return usndict
1 t00m 65
 
66
if __name__ == '__main__':
67
    main()