Skip to content

Added f-strings in the python scripts of /tools - #1

Merged
NexzaDev merged 5 commits into
NexzaDev:mainfrom
darknesspwner:main
Oct 18, 2026
Merged

NexzaDev merged 5 commits into
NexzaDev:mainfrom
darknesspwner:main

Conversation

@darknesspwner

@darknesspwner darknesspwner commented Oct 18, 2026 •

Copy link
Copy Markdown

Description

I added f-strings instead of the legacy one using the modulo % in tools/

In simple terms. instead of writing:

print("checked: %d scripts, %d with problems, %d below size target" % (len(results), len(bad), len(short)))

You can just write:

print(f"checked: {len(results)} scripts, {len(bad)} with problems, {len(short)} below size target")

It does the exact same thing, but the second is more readable to everyone

Type of change

  • New script
  • Fix for an existing script
  • Documentation
  • Other

Script details (for new or changed scripts)

  • Script name: lint_nse.py, smoke_nse.py
  • Folder: /tools
  • Risk level: None
  • Tested against (lab or authorized target only, no real hostnames or IPs): None (the python scripts were tested)

Checklist

  • [X ] Script runs without errors against a lab target I own or am authorized to test
  • [ X] Script has a description, author, license, and categories field
  • [ X] Risk level is accurately assessed
  • [ X] python3 tools/lint_nse.py passes
  • [ X] Folder README.md updated (and the root README.md Categories table for new folders)
  • [ X] No hardcoded credentials, IPs, or destructive/intrusive actions
  • [ X] No real hostnames, IPs or third-party data anywhere in the change
  • [X ] Any write operation is documented and justified
  • [ X] I wrote this contribution myself, with no AI-generated content
  • [X ] No code copied from Nmap's bundled scripts or libraries, and I can release this under the MIT License

Shadow added 3 commits October 18, 2026 13:48
Signed-off-by: Shadow <Xristoslazaris21@protonmail.com>
Signed-off-by: Shadow <Xristoslazaris21@protonmail.com>
Signed-off-by: Shadow <Xristoslazaris21@protonmail.com>
@NexzaDev

Copy link
Copy Markdown
Owner

Thanks for the contribution! Two fixes needed before I can merge:

  1. tools/smoke_nse.py: the last print uses {faulries}, which is undefined. It should be {failures}. As written the script raises a NameError at the end of every run.
  2. tools/lint_nse.py: the "MISSING/unknown Risk Level" message used %r. Please keep that behaviour with {risk!r}.

Please also run python3 tools/smoke_nse.py locally after the change and confirm it finishes without errors.

@darknesspwner

Copy link
Copy Markdown
Author

Ok let me fix that real quick

Thanks for the contribution! Two fixes needed before I can merge:

1. tools/smoke_nse.py: the last print uses {faulries}, which is undefined. It should be {failures}. As written the script raises a NameError at the end of every run.

2. tools/lint_nse.py: the "MISSING/unknown Risk Level" message used %r. Please keep that behaviour with {risk!r}.

Please also run python3 tools/smoke_nse.py locally after the change and confirm it finishes without errors.

Shadow added 2 commits October 18, 2026 14:28
Signed-off-by: Shadow <Xristoslazaris21@protonmail.com>
Signed-off-by: Shadow <Xristoslazaris21@protonmail.com>
@NexzaDev
NexzaDev merged commit 4606f9f into NexzaDev:main Oct 18, 2026
1 check passed
Repository owner locked and limited conversation to collaborators Oct 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants