Skip to content

Refactor _exec_cmd to use shlex and lists#4990

Open
harshnair75567-cloud wants to merge 1 commit into
secdev:masterfrom
harshnair75567-cloud:master
Open

Refactor _exec_cmd to use shlex and lists#4990
harshnair75567-cloud wants to merge 1 commit into
secdev:masterfrom
harshnair75567-cloud:master

Conversation

@harshnair75567-cloud
Copy link
Copy Markdown

Checklist :

  • [ x] If you are new to Scapy: I have checked CONTRIBUTING.md (esp. section submitting-pull-requests)
  • [x ] I squashed commits belonging together
  • I added unit tests or explained why they are not relevant
  • I executed the regression tests (using tox)
  • If the PR is still not finished, please create a Draft Pull Request
  • [ x] This PR uses (partially) AI-generated code. If so:
    • [x ] I ensured the generated code follows the internal concepts of scapy
    • This PR has a test coverage > 90%
    • [ x] I reviewed every generated line
    • If this PR contains more than 500 lines of code (excluding unit tests) I considered splitting this PR.
    • I considered interoperability tests with existing packages or utilities to ensure conformity of a newly generated protocol

I understand that failing to mention the use of AI may result in a ban. (We do not forbid it, but you must play fair. Be warned !)

fixes #xxx

@harshnair75567-cloud
Copy link
Copy Markdown
Author

_exec_cmd switches from shell=True with a raw string to shell=False with shlex.split, so the command is never interpreted. _npcap_set and _npcap_get pass arguments as a list instead of joining them into a string, removing the injection point before it even reaches _exec_cmd

@codecov
Copy link
Copy Markdown

codecov Bot commented May 16, 2026

Codecov Report

❌ Patch coverage is 25.00000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.28%. Comparing base (1abd9dd) to head (34d9695).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
scapy/arch/windows/__init__.py 25.00% 6 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4990   +/-   ##
=======================================
  Coverage   80.27%   80.28%           
=======================================
  Files         383      383           
  Lines       94703    94704    +1     
=======================================
+ Hits        76027    76035    +8     
+ Misses      18676    18669    -7     
Files with missing lines Coverage Δ
scapy/arch/windows/__init__.py 66.48% <25.00%> (+0.06%) ⬆️

... and 6 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant