Update naming and license

This commit is contained in:
Wei Chen 2018-05-11 10:08:16 -05:00
parent 2a7d0ddfd1
commit 82c8138de0
4 changed files with 14 additions and 4 deletions

View File

@ -1,3 +1,8 @@
//
// License:
// https://github.com/rapid7/metasploit-framework/blob/master/LICENSE
//
#define MAX_PATH 260
#define MEM_COMMIT 0x00001000
#define MEM_RESERVE 0x00002000

View File

@ -1,3 +1,8 @@
//
// License:
// https://github.com/rapid7/metasploit-framework/blob/master/LICENSE
//
#define NULL ((void *)0)
#define TRUE 1
#define FALSE 0

View File

@ -15,7 +15,7 @@ module Metasploit
# @param type [Symbol] PE type, either :exe or :dll
# @raise [NotImplementedError] If the type is not supported.
# @return [String] The compiled code.
def self.compile(c_template, type=:exe)
def self.compile_c(c_template, type=:exe)
headers = Compiler::Headers::Win32.new
source_code = Compiler::Utils.normalize_code(c_template, headers)
@ -38,7 +38,7 @@ module Metasploit
# @param c_template [String] The C source code to compile.
# @param type [Symbol] PE type, either :exe or :dll
# @return [Integer] The number of bytes written.
def self.compile_as(out_file, c_template, type=:exe)
def self.compile_c_to_file(out_file, c_template, type=:exe)
pe = self.compile(c_template, type)
File.write(out_file, pe)
end

View File

@ -2,7 +2,7 @@ require 'spec_helper'
require 'metasploit/framework/compiler/win32'
RSpec.describe Metasploit::Framework::Compiler::Win32 do
describe '#self.compile' do
describe '#self.compile_c' do
let(:c_template) {
%Q|#include <Windows.h>
@ -14,7 +14,7 @@ RSpec.describe Metasploit::Framework::Compiler::Win32 do
}
it 'returns an EXE binary' do
bin = Metasploit::Framework::Compiler::Win32.compile(c_template)
bin = Metasploit::Framework::Compiler::Win32.compile_c(c_template)
magic = bin[0, 2]
expect(magic).to eq('MZ')
end