The problem I am having is when I have a Perl script reading data (PE Executable) via STDIN and the stream contains a line terminator "0A" the conversion to hex misses it. Then when I convert the hex data back it is corrupted (missing 0A in the hex format). So how can I detect the "windows" version of line feed "0A" in Perl?
Note: Linux OS (Perl) is reading a Windows PE
!usr/bin/perl
while($line = <STDIN>)
{
chomp($line);
@bytes = split //, $line;
foreach (@bytes)
{
printf "%02lx", ord $_;
}
}
Usage example:
[root@mybox test]# cat test.exe | perl encoder.pl > output