bonsaiviking / nmap-completion

Bash-completion script for Nmap
68 stars 7 forks source link

Complete --script-args based on --script, closes issue #1 #3

Closed rewanthtammana closed 7 years ago

rewanthtammana commented 7 years ago

To auto-complete the --script-args based on --script we have to store them initially in our db file.

Inorder for the script to work, create scripts/script-args.db file. Syntax in the db file: scriptname: arg1 arg2 arg3 For example, the entries should be like shodan-api: shodan-api.hostname shodan-api.port shodan-api.host

Everything else works same as before.

rewanthtammana commented 7 years ago

The script works fine when the db list is small. This script has to read the entire database file when user presses [TAB][TAB] and this process is slow because there are few intermediate stages in between like opening the file, setting the seek position, then scanning each and every line and trimming every line for the script name and finally comparing it with the users input.

So, when the click tries to autocomplete the --script-args option on every double click of the user, all the above steps have to be processed before showing the output which is very cumbersome and it degrades the performance of Nmap.

Another better method is used to complete this task and PR is made on #4