[ create a new paste ] login | about

Link: http://codepad.org/u5OyvQnO    [ raw code | fork ]

Sh3llc0d3 - Ruby, pasted on Sep 2:
#!/usr/bin/ruby
# Author: Sh3llc0d3
# Program: Replace html special characters with there normal equivilant.
# 				Done to correct code fucked up by WAF's.
# Tested: Working with the limited testing i've done on a few c++/c programs.
file_names = Array.new
file_names.push(ARGV[0]);
html_spec = {
	"&lt;" => "<",
	"&gt;" => ">",
	"&amp;" => "&",
	"&#46;" => ".",
	"&#91;" => "[",
	"&#93;" => "]",
	"&#58;" => ":"
	}

file_names.each do |file_name|
	text = File.read(file_name)
	puts text;
	html_spec.each do |spec_chars,r_char|
		output = text.gsub(/#{spec_chars}/, "#{r_char}")
		puts output
		File.open(file_name, "w") { |file| file.puts output};
		text = output;
	end
end


Create a new paste based on this one


Comments: