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

Handle pending queries #1172

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

aniket2405
Copy link

@aniket2405 aniket2405 commented Jan 14, 2025

Fixes Issue

Closes #1169

Changes proposed

Update handle_pending_queries() by making it async and helping in faster query processing.

  1. Converted the handle_pending_queries() function to an async function.
  2. The function now manages a list of tasks (tasks) and creates them using asyncio.create_task.
  3. handle_pending_queries() processes multiple queries concurrently using asyncio.gather for improved performance.
  4. It continuously checks the queue for new items, processes them concurrently, and sleeps for 2 seconds if the queue is empty.

Steps you followed to test the changes purposed in this PR:

  • To test (to-do)

Check List (Check all the applicable boxes)

  • My code follows the code style of this project.
  • My change requires changes to the documentation.
  • I have updated the documentation accordingly.
  • All new and existing tests passed.
  • This PR does not contain plagiarized content.
  • The title of my pull request is a short description of the requested changes.

Screenshots

Note to reviewers

Could someone help me with the list of test cases to run in order to test my changes.

@AlyaGomaa
Copy link
Collaborator

hello @aniket2405 thanks for your effort! that's awesome i think your code is simple and clear, great job!

right now there's no test files to test this part of slips but here's how i would test it manually

  1. run slips on a pcap with some files in files.log, or run slips on your interface and manually download some random files
  2. print pending_queries queue to make sure we have some pending queries (just to know that your function is triggered)
  3. and add some prints to the is_malicious_hash function to make sure the pending queries and correctly passed these and queries are made successfully
    You can do the above steps with a debugger if you want, let me know you tested it and if it's working.

@AlyaGomaa
Copy link
Collaborator

also the tests at test_threat_intelligence.py should be updated based on your changes.

They're failing here
https://github.com/stratosphereips/StratosphereLinuxIPS/actions/runs/12797793693/job/35680692764?pr=1172

you can run them locally using
python3 -m pytest tests/test_threat_intelligence.py -p no:warnings -vv -s -n 5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
2 participants