±Partners and Sponsors

±Your Account


Nickname
Password


Forgotten password/username?


Membership:
New Today: 5
New Yesterday: 12
Overall: 26994
Visitors: 59

±Follow Forensic Focus

Join our LinkedIn group

Subscribe to news

Subscribe to forums

Subscribe to blog

Subscribe to tweets

Batch file / Enscript - HEX to ASCII on multiple .txt files

Computer forensics discussion. Please ensure that your post is not better suited to one of the forums below (if it is, please post it there instead!)
Reply to topicReply to topic Printer Friendly Page
Forum FAQSearchView unanswered posts
Go to page 1, 2  Next 
  

Batch file / Enscript - HEX to ASCII on multiple .txt files

Post Posted: Thu Jan 24, 2013 4:44 pm

Hi,

I'm looking for a batch file or en-script which will convert all hex in a .txt into ascii. I've found one batch script online but it skips large portions of hex. Does anyone have one on hand?

Commercial or open source, all appreciated. Encase / ftk / winhex isnt much use, as it reads the hex as asci (as it should). Unless I'm missing a useful function in winhex (trial) to convert??  

research1
Senior Member
 
 
  

Re: Batch file / Enscript - HEX to ASCII on multiple .txt fi

Post Posted: Thu Jan 24, 2013 5:12 pm

Maybe I am missing the point, but just opening the file in a text editor, Like Notepad, UltraEdit or many others will display a binary file as text. Of course many hex values are outside of the ASCII range, so there is no sensible way to display them. So you'll either get a lot of garbage characters, or a lot values skipped, depending on the tool and font in use.

I think your whole idea of *conversion* to ASCII doesn't make sense. ASCII is a just mapping of values in a file to symbols to characters.

The question would make sense, if it was a conversion from UTF-16 to ASCII. Or a conversion from EBCDIC to ASCII. Or maybe you mean something like converting ASCII HTML hex encoded character references to plain unencoded ASCII?
0x48 0x45 0x4c 0x4c 0x4f = HELLO  

Passmark
Senior Member
 
 
  

Re: Batch file / Enscript - HEX to ASCII on multiple .txt fi

Post Posted: Thu Jan 24, 2013 5:31 pm

Hi Passmark,

"ASCII HTML hex encoded character references to plain unencoded ASCII?" - Highly likely. The data was generated by a web-server.

"So you'll either get a lot of garbage characters, or a lot values skipped, depending on the tool and font in use." - Plenty of garbage characters.

I can decode the hex in web based converters, but I need something that can batch recursive on multiple .txt files.  

research1
Senior Member
 
 
  

Re: Batch file / Enscript - HEX to ASCII on multiple .txt fi

Post Posted: Thu Jan 24, 2013 7:25 pm

Can you give an example of what the source file looks like (or a link to an example file)  

Passmark
Senior Member
 
 
  

Re: Batch file / Enscript - HEX to ASCII on multiple .txt fi

Post Posted: Thu Jan 24, 2013 9:24 pm

Research1, do I understand that you have a text file that contains the following:

Code:
48:65:6c:6c:6f:20:77:6f:72:6c:64:21

And you want to convert that into some one byte character set, e.g., ASCII. That's an interesting question.

Passmark, thanks for participating. And, umm, aren't you a famous rockstar? Smile
_________________
Scott Tucker
Aptegra Consulting, LLC
www.aptegra.com 

TuckerHST
Senior Member
 
 
  

Re: Batch file / Enscript - HEX to ASCII on multiple .txt fi

Post Posted: Thu Jan 24, 2013 11:20 pm

Try this freeware,
www.gdargaud.net/Hack/...Ascii.html
(Disclaimer, I have never used it, but the screen shot looks like it might do what we are guessing you want done).

...aren't you a famous rockstar?


Only in my dreams.....  

Passmark
Senior Member
 
 
  

Re: Batch file / Enscript - HEX to ASCII on multiple .txt fi

Post Posted: Fri Jan 25, 2013 3:30 am

- Passmark
Can you give an example of what the source file looks like (or a link to an example file)


I second this! In the meantime, here's a quick and dirty python 2.x solution assuming your file content is something like this:

48656C6C6F20576F726C64

Code:
import binascii
hex_content = open("c:\\some\\path\\here\\file.txt").read()
ascii_string = binascii.a2b_hex(hex_content)
print ascii_string
hex_file.close()

I had a quick look at doing it in EnScript, but to be honest I find EnScript to be an exercise in frustration with this sort of simple file content processing.  

Chris_Ed
Senior Member
 
 
Reply to topicReply to topic

Share this forum topic to encourage more replies



Page 1 of 2
Go to page 1, 2  Next