OWASP/Python-Honeypot

check for mongodb in startup

Ali-Razmjoo opened this issue · 3 comments

I've noticed when I run api server, it use to check for mongodb if it's up, otherwise return error, but now it just exit!!

batman@Batmans-MacBook-Pro:~/D/G/OWASP-Honeypot:master$ python3 ohp.py --start-api-server

      ______          __      _____ _____
     / __ \ \        / /\    / ____|  __     | |  | \ \  /\  / /  \  | (___ | |__) |
    | |  | |\ \/  \/ / /\ \  \___ \|  ___/
    | |__| | \  /\  / ____ \ ____) | |
     \____/   \/  \/_/    \_\_____/|_|
                      _    _                        _____      _
                     | |  | |                      |  __ \    | |
                     | |__| | ___  _ __   ___ _   _| |__) |__ | |_
                     |  __  |/ _ \| "_ \ / _ \ | | |  ___/ _ \| __|
                     | |  | | (_) | | | |  __/ |_| | |  | (_) | |_
                     |_|  |_|\___/|_| |_|\___|\__, |_|   \___/ \__|
                                               __/ |
                                              |___/   

batman@Batmans-MacBook-Pro:~/D/G/OWASP-Honeypot:master$ 

also what happened to logo? 😆

@ChakshuGupta @dhirensr please have a look and send a PR if you can.

@Ali-Razmjoo : I looked into this issue.
the error is here, that we are not raising the error and explicitly checking is_not_run_from_api and I think we should not check that in error function here(https://github.com/zdresearch/OWASP-Honeypot/blob/master/core/alert.py#L271) and would be the solution.
what do you think?

I think since error() usually come with an exist, we are safe to remove if is_not_run_from_api() because it gonna exit anyway right?

@Ali-Razmjoo : yes it's gonna exit anway because sys.exit(1) is also called immediately.