예제 #1
0
파일: views.py 프로젝트: vicgc/wforensic
def index(request):
    """
    Default view
    """

    try:
        wusers = WaContacts.objects.filter(is_whatsapp_user=1).count()
        nwusers = WaContacts.objects.filter(is_whatsapp_user=0).count()
        wasize = getsize(DATABASES['default']['NAME'])
        wafile = basename(DATABASES['default']['NAME'])
        wamd5 = get_md5_file(DATABASES['default']['NAME'])
        washa1 = get_sha1_file(DATABASES['default']['NAME'])
        waperm = "<b><font color=\"red\">YES (check file permissons)</font></b>" if access(DATABASES['default']['NAME'],W_OK) is True else "<b><font color=\"blue\">No</font></b>" 
    except:
        wusers = Messages.objects.using('msgstore').values('key_remote_jid').distinct().count()
        nwusers = 0
        wasize = 0
        wafile = "Not found!"
        wamd5 = "N/A"
        washa1 = "N/A"
        waperm = 'N/A'

    msgperm = "<b><font color=\"red\">YES (check file permissons)</font></b>" if access(DATABASES['msgstore']['NAME'],W_OK) is True else "<b><font color=\"blue\">No</font></b>"

    dic = {
            'whatsappusers': wusers,
            'nonwhatsappusers': nwusers,
            'activity': get_activity_data(None),
            'fromme': Messages.objects.using('msgstore').filter(key_from_me=1).count(),
            'tome': Messages.objects.using('msgstore').filter(key_from_me=0).count(),
            'latest': get_latest_peers(),
            'toppeers': get_top_peers(),
            'msgsize': getsize(DATABASES['msgstore']['NAME']),
            'msgfile': basename(DATABASES['msgstore']['NAME']),
            'msgperm': msgperm,
            'msgmd5': get_md5_file(DATABASES['msgstore']['NAME']),
            'msgsha1': get_sha1_file(DATABASES['msgstore']['NAME']),
            'wasize': wasize,
            'wafile': wafile,
            'wamd5': wamd5,
            'waperm': waperm,
            'washa1': washa1,
            }

    return render_to_response('whatsapp/index.html', dic, context_instance=RequestContext(request))
예제 #2
0
def index(request):
    
    try:
        wusers = WaContacts.objects.filter(is_whatsapp_user = 1).count()
        nwusers = WaContacts.objects.filter(is_whatsapp_user = 0).count()
        wasize = getsize(DATABASES['default']['NAME'])
        wafile = basename(DATABASES['default']['NAME'])
        wamd5 = get_md5_file(DATABASES['default']['NAME'])
        washa1 = get_sha1_file(DATABASES['default']['NAME'])
    except:
        wusers = Messages.objects.using('msgstore').values('key_remote_jid').distinct().count()
        nwusers = 0
        wasize = 0
        wafile = "Not found!"
        wamd5 = "N/A"
        washa1 = "N/A"
    
    dic = {
            'whatsappusers': wusers,
            'nonwhatsappusers': nwusers,
            'activity': get_activity_data(None),
            'fromme': Messages.objects.using('msgstore').filter(key_from_me = 1).count(),
            'tome': Messages.objects.using('msgstore').filter(key_from_me = 0).count(),
            'latest': get_latest_peers(),
            'toppeers': get_top_peers(),
            'msgsize': getsize(DATABASES['msgstore']['NAME']),
            'msgfile': basename(DATABASES['msgstore']['NAME']),
            'msgmd5': get_md5_file(DATABASES['msgstore']['NAME']),
            'msgsha1': get_sha1_file(DATABASES['msgstore']['NAME']),
            'wasize': wasize,
            'wafile': wafile,
            'wamd5': wamd5,
            'washa1': washa1,
            }

    return render_to_response('whatsapp/index.html',dic,context_instance=RequestContext(request))