Files
metasploit-gs/lib/rex/string_utils.rb
T
Spoon M 61aa203c3f added remove_badchars, ruby rocks
git-svn-id: file:///home/svn/incoming/trunk@2610 4d416f70-5f16-0410-b530-b9f4589650da
2005-06-09 17:46:45 +00:00

24 lines
395 B
Ruby

#!/usr/bin/ruby
module Rex
module StringUtils
#
# Return the index of the first badchar in data, otherwise return
# nil if there wasn't any badchar occurences.
#
def self.badchar_index(data, badchars)
badchars.each_byte { |badchar|
pos = data.index(badchar)
return pos if pos
}
return nil
end
def self.remove_badchars(data, badchars)
data.delete(badchars)
end
end end