/
githubmirror
/
metasploit-framework
Обзор
Документация
Войти
/
githubmirror
/
metasploit-framework
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
tools/exploit/random_compile_c.rb
41 строка
1 KB
adfoster-r7
Fix Ruby 3.2 crash when running certain tools
06 мар 2023, 14:03
Не верифицирован
06 мар 2023, 14:03
4f75a44
Код
Авторство
О чём код?
#!/usr/bin/env ruby # -*- coding: binary -*- def help puts "Usage:" puts "#{__FILE__} [weight] [source code path] [output path]" puts puts "Example:" puts "#{__FILE__} 80 /tmp/helloworld.c /tmp/helloworld.exe" exit end help if ARGV.empty? || ARGV.include?('-h') begin msfbase = __FILE__ while File.symlink?(msfbase) msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase)) end $:.unshift(File.expand_path(File.join(File.dirname(msfbase), '..', '..', 'lib'))) require 'msfenv' require 'metasploit/framework/compiler/windows' weight = ARGV.shift source_code_path = ARGV.shift out_path = ARGV.shift if source_code_path.nil? || source_code_path.empty? || !File.exist?(source_code_path) puts "Please set the source code path" exit elsif out_path.nil? || out_path.empty? puts "Please set the destination path" exit end source_code = File.read(source_code_path) Metasploit::Framework::Compiler::Windows.compile_random_c_to_file(out_path, source_code, weight: weight.to_i) if File.exist?(out_path) puts "File saved as #{out_path}" end rescue SignalException => e puts("Aborted! #{e}") end