LinuxDC++ Voyeur edition + webapp.

I’m dumping the source for the dc++ voyeur edition which caused quite a bit of privacy fears. I do not endorse it’s usage, and am distributing it in the hopes that it’s useful.

I trimmed down the hacks to the main codebase, using the internal logging engine (which is pretty nice and asynchronous) in the place of my previous self-written stdio file writing engine.

How to use this: Compile using scons, like regular linuxdcpp (I won’t go verbose as to how), and just run it. Make sure that you enable the logging for system events. (Preferences -> Logs -> Log system messages).

In ~/.dc++/Logs/system.log, messages will be written like: [2008-09-07 15:35] [SEARCH] {IP:{10.255.255.255:4242}} {QUERY:{James$Bond}} [2008-09-08 12:57] [LOGIN] {NICK{enpower}} {IP{10.255.255.255}} [2008-09-08 12:57] [LOGOUT] {NICK{enpower}} {IP{10.255.255.255}} You can use anything to process the logs. If you’re the hardcore unix types, use sed or awk. Or if you have a python fetish, you can see what I’ve done here. (This is part of a script for a django app, so it won’t work standalone)

!/usr/bin/python

indexlogs.py : Index the logs of custom linuxdc++ and add them to the django db

Author: Anirudh Sanjeev (anirudh at anirudhsanjeev dot org)

from django.core.management import setup_environ import settings setup_environ(settings)

from dctrends.searchtrends.models import Event, Search import datetime, sys import logging, re

Create a logger

logger = logging.getLogger("main_logger") logger.setLevel(logging.DEBUG)

Create a console handler

ch = logging.StreamHandler() ch.setLevel(logging.DEBUG)

Create a formatter

formatter = logging.Formatter("%(asctime)s - %(message)s") ch.setFormatter(formatter) logger.addHandler(ch)

Create a logging object

LOG = logger.info

Get the log path

logpath = "/home/anirudh/.dc++/Logs/system.log" line_num = 0 max_lines = 100 # Redundant. For debugging purposes only. logfile = open(logpath) searchre = re.compile("SEARCH") ipre = re.compile("{IP:{.:[0-9]}}") queryre = re.compile("{QUERY:{.*}}")

for line in logfile: if(searchre.search(line)): if not ipre.search(line): continue if not queryre.search(line): continue iptext = ipre.search(line).group() iptext = iptext[5:len(iptext)-2] query = queryre.search(line).group() query = query[8:len(query)-2] if len(query) > 48: # Prevent really long strings continue iptext = re.compile(":").split(iptext)[0] query = re.compile("\$").subn(" ", query)[0] # query contains the query text # iptext contains the ip address s = Search() s.query = query s.origin = iptext s.timestamp = datetime.datetime.now() s.hall = 111 s.type = 1

    LOG("Saving: %s from %s",query, iptext)
    s.save()

So anyways, you can download it here.

3 Responses to “LinuxDC++ Voyeur edition + webapp.”


Leave a Reply