Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Converting hex or dec to ascii ?

Reply
Thread Tools

Converting hex or dec to ascii ?

 
 
mrpink
Guest
Posts: n/a
 
      04-13-2007
Hi,
I have a variable like:

test = 0x65 0x78

and I wanna have this converted or outputet to-----> ex

which is the ascii code of 0x65 (=e) and 0x78 (=x) . But how can I do
this ?

test = 0x65 doesn't, test = "0x65" doesn't test = String(0x65) also
doesn't...

can someone please help me with this?

greets
 
Reply With Quote
 
 
 
 
Abhijit Gadgil
Guest
Posts: n/a
 
      04-13-2007
T24gNC8xMy8wNywgbXJwaW5rIDxhZG5hcmltQG1haWwucnU+IH dyb3RlOgo+IEhpLAo+IEkgaGF2
ZSBhIHZhcmlhYmxlIGxpa2U6Cj4KPiB0ZXN0ID0gMHg2NSAweD c4Cj4KPiBhbmQgSSB3YW5uYSBo
YXZlIHRoaXMgY29udmVydGVkIG9yIG91dHB1dGV0IHRvLS0tLS 0+IGV4Cj4KPiB3aGljaCBpcyB0
aGUgYXNjaWkgY29kZSBvZiAweDY1ICg9ZSkgYW5kIDB4NzggKD 14KSAuIEJ1dCBob3cgY2FuIEkg
ZG8KPiB0aGlzID8KPgo+IHRlc3QgPSAweDY1IGRvZXNuJ3QsIH Rlc3QgPSAiMHg2NSIgZG9lc24n
dCB0ZXN0ID0gU3RyaW5nKDB4NjUpIGFsc28KPiBkb2Vzbid0Li 4uCgpJZiB5b3UgaGF2ZSB0aGlz
IGluIGFuIGFycmF5LCB5b3UgY2FuIHVzZSBBcnJheSNwYWNrCg plZy4KCmEgPSAgWzB4NjUsIDB4
NzhdLgphLnBhY2soIlUqIikKClRoaXMgd2lsbCB3b3JrIGZvci BtdWx0aWJ5dGUgdW5pY29kZSBz
dHJpbmdzIGFzIHdlbGwuCgpIdGguCgotLSAKCuCkheCkreCkv+ CknOClgOCkpAoKW3dyaXR0ZW4g
aW4gaHR0cDovL3d3dy5wYWFoaWplbi5jb20vc2NyYXRjaHBhZF 0KCltodHRwOi8vd3d3LnBhYWhp
amVuLmNvbV0K

 
Reply With Quote
 
 
 
 
Robert Klemme
Guest
Posts: n/a
 
      04-13-2007
On 13.04.2007 17:47, mrpink wrote:
> Hi,
> I have a variable like:
>
> test = 0x65 0x78


What exactly is this supposed to mean? This is not valid Ruby:

$ ruby -ce 'test = 0x65 0x78'
-e:1: parse error, unexpected tINTEGER, expecting $

> and I wanna have this converted or outputet to-----> ex
>
> which is the ascii code of 0x65 (=e) and 0x78 (=x) . But how can I do
> this ?
>
> test = 0x65 doesn't, test = "0x65" doesn't test = String(0x65) also
> doesn't...
>
> can someone please help me with this?


Very likely, if we know what your input is.

robert
 
Reply With Quote
 
mrpink
Guest
Posts: n/a
 
      04-13-2007
yeah this was wrong varibale too... but I got it out:


shellcode = "\x65\x61"

puts(shellcode)


does what I needed
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hex Color Codes - Hex 6 <=> Hex 3 lucanos@gmail.com HTML 10 08-18-2005 11:21 PM
where on the web are the characters for UTF-8 listed in dec or hex value? lkrubner@geocities.com XML 2 05-28-2005 09:05 AM
ANNOUNCEMENT: NYLXS Open House Dec. 6; Perl Classes Dec. 8th J.E./C.Y.Cripps Perl Misc 0 12-03-2004 04:44 PM
Question: HEX <-> DEC constants auto-conversion in C source file? ^_^ C++ 2 01-06-2004 11:55 PM
hex(-5) => Futurewarning: ugh, can't we have a better hex than '-'[:n<0]+hex(abs(n)) ?? Bengt Richter Python 6 08-19-2003 07:33 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57