Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/lib/msf/ui/console/command_dispatcher/nop.rb
Views: 11786
# -*- coding: binary -*-12module Msf3module Ui4module Console5module CommandDispatcher67###8#9# NOP module command dispatcher.10#11###12class Nop1314include Msf::Ui::Console::ModuleCommandDispatcher1516@@generate_opts = Rex::Parser::Arguments.new(17"-b" => [ true, "The list of characters to avoid: '\\x00\\xff'" ],18"-h" => [ false, "Help banner." ],19"-s" => [ true, "The comma separated list of registers to save." ],20"-t" => [ true, "The output type: ruby, perl, c, or raw." ])2122#23# Returns the hash of supported commands.24#25def commands26super.update({27"generate" => "Generates a NOP sled",28})29end3031#32# Returns the name of the command dispatcher.33#34def name35"Nop"36end3738#39# Generates a NOP sled.40#41def cmd_generate(*args)4243# No arguments? Tell them how to use it.44if (args.length == 0)45args << "-h"46end4748# Parse the arguments49badchars = nil50saveregs = nil51type = "ruby"52length = 2005354@@generate_opts.parse(args) { |opt, idx, val|55case opt56when nil57length = val.to_i58when '-b'59badchars = Rex::Text.dehex(val)60when "-s", "-c" # 'c' is deprecated; remove later61saveregs = val.split(/,\s?/)62saveregs = val.split(/,\s?/)63when '-t'64type = val65when '-h'66print(67"Usage: generate [options] length\n\n" +68"Generates a NOP sled of a given length.\n" +69@@generate_opts.usage)70return false71end72}7374# Generate the sled75begin76sled = mod.generate_simple(77length,78'BadChars' => badchars,79'SaveRegisters' => saveregs,80'Format' => type)81rescue82log_error("Sled generation failed: #{$!}.")83return false84end8586# Display generated sled87print(sled)8889return true90end9192end9394end end end end959697