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/core/exploit/riff.rb
Views: 11623
# -*- coding: binary -*-12module Msf34###5#6# This module provides some functions for dealing with MCI RIFF data7#8###910module Exploit::RIFF1112#13# Builds a RIFF chunk with a specified tag and data14#15def riff_chunk(tag, data)1617len = data.length18padding = len % 2 # RIFF chunks must be 2 byte aligned1920return tag + [len].pack('V') + data + ("\x00" * padding)21end2223#24# Builds a RIFF list chunk (one containing other chunks)25#26def riff_list_chunk(tag, type, data)2728len = data.length + 429padding = len % 23031return tag + [len].pack('V') + type + data32end3334#35# Generates a random number of random RIFF chunks, up to 4352 bytes36#37def random_riff_chunks(count = rand(16) + 17)38chunks = ''39400.upto(count) do41chunks << random_riff_chunk()42end4344return chunks45end4647#48# Generates a random RIFF chunk, up to 136 bytes49#50def random_riff_chunk(len = rand(128) + 1)51riff_chunk(random_riff_tag, rand_text(len))52end535455#56# Generates a random RIFF tag, making sure that it's not one of the57# tags processed by LoadAniIcon or LoadCursorIconFromFileMap58#59def random_riff_tag60valid = ['RIFF', 'ACON', 'anih', 'LIST', 'fram', 'icon', 'rate']6162tag = nil63begin64tag = rand_text_alpha(4)65end while valid.include? tag6667return tag68end6970end7172end737475