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/modules/nops/ppc/simple.rb
Views: 11778
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45###6#7# SingleByte8# ----------9#10# This class implements simple NOP generator for PowerPC11#12###13class MetasploitModule < Msf::Nop141516def initialize17super(18'Name' => 'Simple',19'Alias' => 'ppc_simple',20'Description' => 'Simple NOP generator',21'Author' => 'hdm',22'License' => MSF_LICENSE,23'Arch' => ARCH_PPC)2425register_advanced_options(26[27OptBool.new('RandomNops', [ false, "Generate a random NOP sled", true ])28])29end303132def generate_sled(length, opts)3334badchars = opts['BadChars'] || ''35random = opts['Random'] || datastore['RandomNops']3637if random381.upto(1024) do |i|39regs_d = (rand(0x8000 - 0x0800) + 0x0800).to_i40regs_b = [regs_d].pack('n').unpack('B*')[0][1, 15]41flag_o = rand(2).to_i42flag_r = rand(2).to_i4344pcword = ["011111#{regs_b}#{flag_o}100001010#{flag_r}"].pack("B*")45failed = false4647pcword.each_byte do |c|48failed = true if badchars.include?(c.chr)49end5051next if failed5253return (pcword * (length / 4))[0, length]54end55end5657return ("\x60" * length)[0, length]58end59end606162