Permalink
Browse files

nsm-console can now be installed to an external directory.

  • Loading branch information...
dakrone
dakrone committed Jun 4, 2009
1 parent 6573804 commit cfb30aa5c38ce987d07acf96dc1868f383f95a11
Showing with 11 additions and 7 deletions.
  1. +2 −0 .gitignore
  2. +1 −1 TODO
  3. +1 −1 lib/encodelib.rb
  4. +2 −1 lib/logging.rb
  5. +5 −4 nsm
View
@@ -0,0 +1,2 @@
+*.swp
+nsm*.log
View
2 TODO
@@ -54,7 +54,7 @@ DONE - "dump" command supports directories
DONE - "iplist" command needs to support directories of pcap files
- Rewrite pcapparser to use Ruby's builtin BinData so it's easier to extend
DONE - Expand ~ for modload command
-- Make nsm-console "installable" to a different directory, rather than running it out of the distribution dir.
+DONE - Make nsm-console "installable" to a different directory, rather than running it out of the distribution dir.
DONE - Fixed error in iplist where the ips were not listed due to uninitialized array.
- A copy of the run log (PLUS OUTPUT) should go in ${OUTPUT_DIR}. Use IO.popen to grab output
View
@@ -133,5 +133,5 @@ def Encoder.decode_rot13(str)
list = enclist.concat(declist)
list.uniq!
list.each { |l|
- $tabstrings.push(l.to_s)
+ $tabstrings << l.to_s
}
View
@@ -52,7 +52,8 @@ def Logger.start_logging(logfilename)
end
def Logger.get_def_log_file
- logfilename = "logs/nsm-log."
+ # This will default to the <nsm-root-dir>/logs/nsm-log.<time>
+ logfilename = File.dirname(__FILE__) + "/../logs/nsm-log."
logfilename.concat(Time.now.year.to_s)
logfilename.concat(Time.now.month.to_s)
logfilename.concat(Time.now.day.to_s)
View
9 nsm
@@ -22,6 +22,9 @@
$NSM_VERSION = "0.8-DEVEL"
+# Add the directory nsm is in to the include path
+$:.push(File.dirname(__FILE__))
+
## Require ruby files, required for tab completion and up-down history
require 'readline'
include Readline
@@ -37,9 +40,7 @@ require 'lib/commands'
# grab a list of all available commands
$tabstrings = CommandManager.get_commands_as_array()
# Add 3 more completions used often
-$tabstrings.push("PCAP_FILE")
-$tabstrings.push("PCAP_BASE")
-$tabstrings.push("OUTPUT_DIR")
+$tabstrings << "PCAP_FILE" << "PCAP_BASE" << "OUTPUT_DIR"
## NOTE: THIS DOESN'T WORK YET :X
## We're taking out space so it treats the whole line as 1 string
@@ -105,7 +106,7 @@ require 'lib/colors'
## Defaults for variables
## Default module directory
-$moduledir = "modules"
+$moduledir = File.dirname(__FILE__) + "/modules"
## Default output directory
$outputdir = "${PCAP_BASE}-output"

0 comments on commit cfb30aa

Please sign in to comment.