Sha256: b388441c9b9fc7e5c29afb64e6cc4e17c3d1c1df6378bdf7d22da82c1ba6f9be

Contents?: true

Size: 1.39 KB

Versions: 64

Compression:

Stored size: 1.39 KB

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

require 'yaml'
require 'digest'
require 'fileutils'

if ENV['PWN_ROOT']
  pwn_root = ENV['PWN_ROOT']
elsif Dir.exist?('/pwn')
  pwn_root = '/pwn'
else
  pwn_root = Dir.pwd
end

pwn_provider = ENV['PWN_PROVIDER'] if ENV['PWN_PROVIDER']
userland_config = "#{pwn_root}/etc/userland/#{pwn_provider}/burpsuite/vagrant.yaml"
userland_burpsuite_pro_jar_path = "#{pwn_root}/third_party/burpsuite-pro.jar"
burpsuite_pro_jar_dest_path = "/opt/burpsuite/#{File.basename(userland_burpsuite_pro_jar_path)}"
if File.exist?(userland_burpsuite_pro_jar_path)
  burpsuite_pro_yaml = YAML.load_file(userland_config)
  burpsuite_pro_jar_sha256_sum = burpsuite_pro_yaml['burpsuite_pro_jar_sha256_sum']
  # license_key = burpsuite_pro_yaml['license_key'].to_s.scrub.strip.chomp

  this_sha256_sum = Digest::SHA256.file(userland_burpsuite_pro_jar_path).to_s

  if this_sha256_sum == burpsuite_pro_jar_sha256_sum
    print "Copying #{userland_burpsuite_pro_jar_path} to #{burpsuite_pro_jar_dest_path}..."
    system("sudo cp #{userland_burpsuite_pro_jar_path} #{burpsuite_pro_jar_dest_path}")
  else
    puts "#{burpsuite_pro_jar_dest_path}: (SHA256 Sum #{this_sha256_sum})"
    puts "!= #{userland_config} (SHA256 Sum: #{burpsuite_pro_jar_sha256_sum})"
    print 'removing...'
    system("sudo rm #{userland_burpsuite_pro_jar_path} #{burpsuite_pro_jar_dest_path}")
  end
  puts 'complete.'
end

Version data entries

64 entries across 64 versions & 1 rubygems

Version Path
pwn-0.4.339 vagrant/provisioners/burpsuite_pro.rb
pwn-0.4.338 vagrant/provisioners/burpsuite_pro.rb
pwn-0.4.336 vagrant/provisioners/burpsuite_pro.rb
pwn-0.4.333 vagrant/provisioners/burpsuite_pro.rb