BasicObject
Architecture constants
Creation flags
Permissions
Endian constants
Event Log
Event Log
An instance of the log dispatcher exists in the global namespace, along with stubs for many of the common logging methods. Various sources can register themselves as a log sink such that logs can be directed at various targets depending on where they're sourced from. By doing it this way, things like sessions can use the global logging stubs and still be directed at the correct log file.
Generic permissions
Registry
Registry Permissions
LEV_0 - Default
This log level is the default log level if none is specified. It should be used when a log message should always be displayed when logging is enabled. Very few log messages should occur at this level aside from necessary information logging and error/warning logging. Debug logging at level zero is not advised.
LEV_1 - Extra
This log level should be used when extra information may be needed to understand the cause of an error or warning message or to get debugging information that might give clues as to why something is happening. This log level should be used only when information may be useful to understanding the behavior of something at a basic level. This log level should not be used in an exhaustively verbose fashion.
LEV_2 - Verbose
This log level should be used when verbose information may be needed to analyze the behavior of the framework. This should be the default log level for all detailed information not falling into LEV_0 or LEV_1. It is recommended that this log level be used by default if you are unsure.
LEV_3 - Insanity
This log level should contain very verbose information about the behavior of the framework, such as detailed information about variable states at certain phases including, but not limited to, loop iterations, function calls, and so on. This log level will rarely be displayed, but when it is the information provided should make it easy to analyze any problem.
Log severities
Page Protections
Generic process open permissions
Process Permissions
Generic page protection flags
Globalized socket constants
Generic thread open permissions
Thread Permissions
Keyboard Mappings
# File lib/rex/zip/samples/recursive.rb, line 15 def add_file(zip, path) zip.add_file(path) end
If it's a directory, Walk the directory and add each item
# File lib/rex/zip/samples/recursive.rb, line 23 def add_files(zip, path, recursive = nil) if (not add_file(zip, path)) return nil end if (recursive and File.stat(path).directory?) begin dir = Dir.open(path) rescue # skip this file return nil end dir.each { |f| next if (f == '.') next if (f == '..') full_path = path + '/' + f st = File.stat(full_path) if (st.directory?) puts "adding dir #{full_path}" add_files(zip, full_path, recursive) elsif (st.file?) puts "adding file #{full_path}" add_file(zip, full_path) end } end end
# File lib/rex/logging/log_dispatcher.rb, line 166 def deregister_log_source(src) $dispatcher.delete(src) end
# File lib/rex/logging/log_dispatcher.rb, line 132 def dlog(msg, src = 'core', level = 0, from = caller) $dispatcher.log(LOG_DEBUG, src, level, msg, from) end
# File lib/rex/logging/log_dispatcher.rb, line 136 def elog(msg, src = 'core', level = 0, from = caller) $dispatcher.log(LOG_ERROR, src, level, msg, from) end
# File lib/rex/logging/log_dispatcher.rb, line 174 def get_log_level(src) $dispatcher.get_level(src) end
# File lib/rex/logging/log_dispatcher.rb, line 144 def ilog(msg, src = 'core', level = 0, from = caller) $dispatcher.log(LOG_INFO, src, level, msg, from) end
# File lib/rex/logging/log_dispatcher.rb, line 156 def log_source_registered?(src) ($dispatcher[src] != nil) end
# File lib/rex/zip/samples/mkwar.rb, line 17 def rand_text_alpha(len) buff = "" foo = [] foo += ('A' .. 'Z').to_a foo += ('a' .. 'z').to_a # Generate a buffer from the remaining bytes if foo.length >= 256 len.times { buff << Kernel.rand(256) } else len.times { buff << foo[ rand(foo.length) ] } end return buff end
# File lib/rex/logging/log_dispatcher.rb, line 160 def register_log_source(src, sink, level = nil) $dispatcher[src] = sink set_log_level(src, level) if (level) end
# File lib/rex/logging/log_dispatcher.rb, line 148 def rlog(msg, src = 'core', level = 0, from = caller) if (msg == ExceptionCallStack) msg = "\nCall stack:\n" + $@.join("\n") + "\n" end $dispatcher.log(LOG_RAW, src, level, msg, from) end
# File lib/rex/logging/log_dispatcher.rb, line 170 def set_log_level(src, level) $dispatcher.set_level(src, level) end
Generated with the Darkfish Rdoc Generator 2.