Ejemplo n.º 1
0
 def __init__(self, server=None):
     if not server:
         server = config.read_config()['SERVER']
     self.server = server
Ejemplo n.º 2
0
#!/usr/bin/env python
"""Iterate through a directory of dns pcap files and
export any new and unchanging file to plain txt"""

import os
import time
import datetime
from passive_dns import client
from passive_dns import config
from passive_dns.common import next_filename, is_growing

LOC = config.read_config()['DATADIR']


def upload(fn):
    c = client.SearchClient()
    r = c.upload_pcap(fn)
    r.raise_for_status()
    os.unlink(fn)
    return r.text


def main():
    for f in os.listdir(LOC):
        f = os.path.join(LOC, f)
        if not os.path.exists(f):  #file disappeared
            continue
        if '.pcap' not in f:
            continue

        if os.path.exists(next_filename(f)) or not is_growing(f):
Ejemplo n.º 3
0
 def __init__(self, server=None):
     if not server:
         server = config.read_config()['SERVER']
     self.server = server
Ejemplo n.º 4
0
import time
from passive_dns import search as dns_search
from passive_dns import config

import tornado.options
import tornado.httpserver
import tornado.ioloop
import tornado.web

import logging

import urllib2

from passive_dns.common import calc_checksum

cfg = config.read_config()
DATADIR = cfg['DATADIR']
UPLOADERS = set(cfg.get('UPLOADERS','').split(","))

try :
    from json import dumps as dump_json
except ImportError:
    from simplejson import dumps as dump_json

class PassiveDnsSearcher:

    def __init__(self):
        self.q_search = self.a_search = None
        self.reopen()

    def reopen(self):
Ejemplo n.º 5
0
#!/usr/bin/env python
"""Iterate through a directory of dns pcap files and
export any new and unchanging file to plain txt"""

import os
import time
import datetime
from passive_dns import client
from passive_dns import config
from passive_dns.common import next_filename, is_growing

LOC = config.read_config()['DATADIR']

def upload(fn):
    c = client.SearchClient()
    r = c.upload_pcap(fn)
    r.raise_for_status()
    os.unlink(fn)
    return r.text

def main():
    for f in os.listdir(LOC):
        f = os.path.join(LOC, f)
        if not os.path.exists(f): #file disappeared
            continue
        if '.pcap' not in f:
            continue

        if os.path.exists(next_filename(f)) or not is_growing(f):
            print 'upload', f
            print upload(f)
Ejemplo n.º 6
0
import time
from passive_dns import search as dns_search
from passive_dns import config

import tornado.options
import tornado.httpserver
import tornado.ioloop
import tornado.web

import logging

import urllib2

from passive_dns.common import calc_checksum

cfg = config.read_config()
DATADIR = cfg['DATADIR']
UPLOADERS = set(cfg.get('UPLOADERS', '').split(","))

try:
    from json import dumps as dump_json
except ImportError:
    from simplejson import dumps as dump_json


class PassiveDnsSearcher:
    def __init__(self):
        self.q_search = self.a_search = None
        self.reopen()

    def reopen(self):