tshm
1/31/2014 - 8:26 AM

xferbf.rb

#!/usr/bin/ruby
require 'open-uri'

uri="http://www.transferbigfiles.com/"
email="2sm@csc.jp"
file="b.mpg"
arr={}

open(uri, "User-Agent"=>"Mac Safari") do |f|
	f.each do |line|
		next if not /type="hidden"/=~line
		name = /name=([^ <>]+)/.match(line).to_a[1].gsub(/"/,'')
		value = /value=([^ <>]+)/.match(line).to_a[1].gsub(/"/,'')
		arr[name]=value
	end
end

cmd = "curl -s -A 'Mac Safari' -L -F \"_ctl0:Content:ContentBox1:mcFile01=@#{file}\" -F \"_ctl0:Content:ContentBox1:recipientsTextBox1=#{email}\" "
arr.each do |key,val|
	cmd += "-F \"#{key}=#{val}\" "
end
cmd += "#{uri}Default.aspx"
print cmd, "\n"
system(cmd)