Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug in new function "core.log.__log_into_file" #27

Closed
Ali-Razmjoo opened this issue Feb 3, 2018 · 1 comment
Closed

bug in new function "core.log.__log_into_file" #27

Ali-Razmjoo opened this issue Feb 3, 2018 · 1 comment

Comments

@Ali-Razmjoo
Copy link
Collaborator

Ali-Razmjoo commented Feb 3, 2018

Hello,

I was testing the framework with -t 1000 -M 1000 threads and I've seen sometimes there is a deadlock in this function. Now the framework has a small SQLite database which I used for the web interface and the API. To prevent the deadlock we must remove flock and write the logs directly to the database hosts_log table. we may use the threads for inserting them (to avoid decreasing speed) and this part of core/log.py and do it while inserting logs in the database. we may use scan_id hash for selecting the logs and create the report log file too.

# this part must move into __log_into_file
if api_flag is 0:
        info(messages(language, 171))
    hosts = []
    for log in JSON_Data:
        if log["HOST"] not in hosts:
            hosts.append(log["HOST"])
    for host in hosts:
        for sm in scan_method.rsplit(','):
            remove_old_logs(host, sm, scan_id, language, api_flag)
    if api_flag is 0:
        info(messages(language, 170))
    for log in JSON_Data:
        submit_logs_to_db(language, api_flag, log)

__log_into_file also should be renamed to __log_into_db. and locate in api.__database file.
let me know if anyone has time to work on this.

Regards.

@Ali-Razmjoo Ali-Razmjoo self-assigned this Feb 4, 2018
Ali-Razmjoo pushed a commit that referenced this issue Feb 4, 2018
Ali-Razmjoo pushed a commit that referenced this issue Feb 4, 2018
Ali-Razmjoo pushed a commit that referenced this issue Feb 4, 2018
Ali-Razmjoo pushed a commit that referenced this issue Feb 4, 2018
@Ali-Razmjoo
Copy link
Collaborator Author

Hello,

Bugs fixed, #1

Regards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant