mushorg / glastopf

Web Application Honeypot
http://glastopf.org
558 stars 169 forks source link

Added logging to the profiler #237

Closed sookyp closed 9 years ago

sookyp commented 9 years ago

Attempting to fix issue #26. Besides stdout logging, it also stores/retrieves the comments in a similar way like the former glastopf/modules/reporting/log_postgresql.py

landscape-bot commented 9 years ago

Code Health Repository health decreased by 0.42% when pulling 5a135c5 on sookyp:profiler into 0b1c062 on glastopf:master.

glaslos commented 9 years ago
Traceback (most recent call last):
  File "/home/travis/build/glastopf/glastopf/glastopf/testing/test_honeypot.py", line 57, in test_honeypot_mongo
    self.glastopf = GlastopfHoneypot(work_dir=self.tmpdir, config=config_file)
  File "/home/travis/build/glastopf/glastopf/glastopf/glastopf.py", line 83, in __init__
    self.profiler_available = conf_parser.getboolean("profiler", "enabled")
  File "/usr/lib/python2.7/ConfigParser.py", line 368, in getboolean
    v = self.get(section, option)
  File "/usr/lib/python2.7/ConfigParser.py", line 607, in get
    raise NoSectionError(section)
NoSectionError: No section: 'profiler'
landscape-bot commented 9 years ago

Code Health Repository health decreased by 0.41% when pulling 009c29a on sookyp:profiler into 0b1c062 on glastopf:master.

glaslos commented 9 years ago

@sookyp can you rebase?

katkad commented 9 years ago

rebased. but some tests are failing

katkad commented 9 years ago

rather verbose, but it works

the failing test_honeypot.py fails also on master on my computer

katkad commented 9 years ago

yep, there is an error:

Traceback (most recent call last):
  File "/home/travis/build/mushorg/glastopf/glastopf/testing/test_honeypot.py", line 63, in test_honeypot_mongo
    sensor_address)
  File "/home/travis/build/mushorg/glastopf/glastopf/glastopf.py", line 273, in handle_request
    self.profiler.handle_event(attack_event)
  File "/home/travis/build/mushorg/glastopf/glastopf/modules/processing/profiler.py", line 51, in handle_event
    ip_profile = self.create_new_profile(source_ip)
  File "/home/travis/build/mushorg/glastopf/glastopf/modules/processing/profiler.py", line 176, in create_new_profile
    if self.fetch_as_number(ip_profile):
  File "/home/travis/build/mushorg/glastopf/glastopf/modules/processing/profiler.py", line 128, in fetch_as_number
    '.origin.asn.cymru.com', 'TXT'], stdout=subprocess.PIPE)
  File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory
glaslos commented 9 years ago

dig not installed? https://github.com/sookyp/glastopf/blob/profiler/glastopf/modules/processing/profiler.py#L126

katkad commented 9 years ago

I found this http://stackoverflow.com/questions/24306205/file-not-found-error-when-launching-a-subprocess but solution comes with BIG warning https://docs.python.org/2/library/subprocess.html#frequently-used-arguments I'd rather avoid it if there's other way.

katkad commented 9 years ago

finaly in master https://github.com/mushorg/glastopf/commit/f1842ba1fe99243c957ad715a50bf240a7a65f28