keithjjones / hostintel

A modular Python application to collect intelligence for malicious hosts.
Other
262 stars 51 forks source link

Multiple syntax issues in config file #12

Open deadbits opened 5 years ago

deadbits commented 5 years ago

It seems there's multiple issues with either the config file or its use with ConfigParser (or the ConfigParser version?)

Using the default config and editing it to add my keys throws this exception:

  File "myconf.conf", line 2
    City_Path: ./data/GeoLite2-City.mmdb
             ^
SyntaxError: invalid syntax

I've tried this using just data/GeoLite2-City.mmdb and it has the same problem. Won't run at all due to the vague Exception of "invalid syntax". I think pinning the version of ConfigParser in autorequirements.txt would help since typically ConfigParser takes = instead of :, at least from my experience. I changed this myself in the config but hit another exception with my username for PassiveTotal

  File "myconf.conf", line 8
    Username = [redacted]@[redacted].com
                      ^
SyntaxError: invalid syntax

Putting quotes around my email address then yields this exception:

aswanda:: Research/osint/hostintel ‹master*› » python2 myconf.conf system-list.txt --all
  File "myconf.conf", line 9
    PublicAPI = [REDACTED]
                        ^

Any help here would be greatly appreciated 👍

keithjjones commented 5 years ago

I haven't had to use this tool since I wrote it, but I'll try my best. What platform are you using? What version of Python?

deadbits commented 5 years ago

Yeah I just noticed when the last commit was. I probably wouldn't have added this issue if I noticed that beforehand tbh :) Anyhow, I'm using Python 2.7.15 and macOS 10.14.2

keithjjones commented 5 years ago

It's no problem. It's probably something simple.

I wonder if it has something to do with the underscore in the value name?

https://github.com/keithjjones/hostintel/blob/master/sampleconfig.conf#L2

That's the only one that has one in that config file. You could test it by changing the code and the config file.

keithjjones commented 5 years ago

This is where it is used... https://github.com/keithjjones/hostintel/blob/master/hostintel.py#L80

deadbits commented 5 years ago

Cool, thanks for the info. I'll do some debugging and get back to you - not super urgent on my end so no worries. If I figure out a solution I'll just post it here and close out the ticket

deadbits commented 5 years ago

Putting certain config values in quotes fixed in the syntax error problem, now I'm hitting this:

hostintel ‹master*› » python2 myconf.conf system-list.txt --all                                                                           1 ↵
Traceback (most recent call last):
  File "myconf.conf", line 1, in <module>
    [GeoIP2]
NameError: name 'GeoIP2' is not defined

It very much does exist though. This is turning into a rabbit hole :p

keithjjones commented 5 years ago

A recent issue was posted here with configparser. I wonder if it's related.

keithjjones commented 5 years ago

Any developments with this one?

deadbits commented 5 years ago

I actually haven't looked at this recently since my last comment much, I'll check it out again this weekend and send an update. I'll likely re-clone the repo and start from scratch in a venv just to make sure nothing external interferes