metasploit-framework

https://github.com/rapid7/metasploit-framework

Ruby

Metasploit Framework

Metasm::Expression#match

a pattern-matching method
Expression[42, :+, 28].match(Expression['any', :+, 28], 'any') => {'any' => 42}
Expression[42, :+, 28].match(Expression['any', :+, 'any'], 'any') => false
Expression[42, :+, 42].match(Expression['any', :+, 'any'], 'any') => {'any' => 42}
vars can match anything except nil

Source | Google | Stack overflow

Edit

git clone [email protected]:rapid7/metasploit-framework.git

cd metasploit-framework

open lib/metasm/metasm/main.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Metasm--Expression-match-for-pr


# Commit to git

git add lib/metasm/metasm/main.rbgit commit -m "better docs for Metasm::Expression#match"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-Metasm--Expression-match-for-pr

hub pull-request


# Celebrate!