outputpbnj Error: Error in option spec: “test|=s”, Error in option spec: “debug|=s”
Posted by alex in Errors at 1:38 AMEarlier tonight while testing the functionality of pbnj including both scanpbnj and outputpbnj on Backtrack Linux I noticed an error with outputpbnj. It appears that during one of the last updates the developer accidentally let a small bug slip by but unfortunately it stops outputpbnj from working at all. The good news is the outputpbnj bug is really easy to fix by remove a couple characters from a single line of the code base. Follow the directions below to get outputpbnj working properly on Backtrack Linux 5 R2.
PBNJ: outputpbnj Error On Backtrack Linux 5 R2:
root@bt:~# outputpbnj --help Error in option spec: "test|=s" Error in option spec: "debug|=s" root@bt:~#
The above error outputs when any switches are added to the outputpbnj command. If you only type “outputpbnj” then you will receive the help list but again if any switches are added you receive the above error leaving outputpbnj useless. To fix the error and get outputpbnj working use the below details. The outputpbnj script is located at the below path.
PBNJ: outputpbnj Path On Backtrack Linux:
/usr/local/bin/outputpbnj
PBNJ: Original outputpbnj Code Causing Error:
697 GetOptions(
698 %options,
699 'type|t=s', 'file|f=s', 'lookup|l=s', 'both|b',
700 'query|q=s', 'names|n', 'desc|d', 'sql|s', 'list',
701 'dbconfig=s', 'configdir=s', 'dir=s', 'data=s', 'qconfig=s',
702 'test|=s', 'debug|=s',
703 'help|h' => sub { help(); },
704 'version|v' => sub { print_version(); },
705 'both' => sub { $bothOutput = 1 },
706 )
The Perl code causing the issue in outputpbnj is on line 702. Below shows the updated Perl code that resolves the outputpbnj errors. To resolve we simply remove the | or pipe before the equal sign for both test and debug on line 702 of the outputpbnj Perl code.
**NOTE** It is always best practice to backup any file before making changes to it. This way if there are any issues or you need to rollback you always have the original file.
PBNJ: Modified outputpbnj Code Resolving Errors:
697 GetOptions(
698 %options,
699 'type|t=s', 'file|f=s', 'lookup|l=s', 'both|b',
700 'query|q=s', 'names|n', 'desc|d', 'sql|s', 'list',
701 'dbconfig=s', 'configdir=s', 'dir=s', 'data=s', 'qconfig=s',
702 'test=s', 'debug=s',
703 'help|h' => sub { help(); },
704 'version|v' => sub { print_version(); },
705 'both' => sub { $bothOutput = 1 },
706 )
Now when we run the original outputpbnj command that included the –help switch we get the expected results as shown in the below example.
PBNJ: outputpbnj Switches Now Working As Expected On Backtrack Linux:
root@bt:~# outputpbnj --help
Usage: outputpbnj [Query Options] [Config Options] [General Options]
Query Options:
-q --query <name> Perform sql query
-t --type <type> Output Type [csv,tab,html]
-f --file <filename> Store the result in file otherwise stdout
--both Print results and store them in a file
--dir <dir> Store the result in this directory [def .]
-l --lookup <name> Lookup descrition based on name
--list List of names and descriptions
-n --name Lookup all the names
-d --desc Lookup all the descriptions
-s --sql Lookup all the sql queries
Config Options:
--qconfig <file> Config of sql queries [def query.yaml]
--dbconfig <file> Config for accessing database [def config.yaml]
--configdir <dir> Directory for the database config file
--data <file> SQLite Database override [def data.dbl]
General Options:
--test <level> Testing information
--debug <level> Debug information
-v --version Display version
-h --help Display this information
Send Comments to Joshua D. Abraham ( jabra@ccs.neu.edu )
root@bt:~#
Now you can use outputpbnj to generate reports from network device and network service scan results created by scanpbnj.
|
|
|
|




Entries (RSS)
thanks for the fix ;) been searching for quite some time.
[Reply]
alex Reply:
January 28th, 2013 at 11:01 AM
Hello anon,
No problem. Thanks for taking the time to leave feedback.
Thanks.
alex
[Reply]