Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

sending hexadecimal data via telnet

by Looserette (Initiate)
on Aug 07, 2012 at 13:11 UTC ( #985977=perlquestion: print w/replies, xml ) Need Help??
Looserette has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

I fear that's an easy question, but I just can't find the answer ... (maybe I'm not using the right words).

Here's a snippet of snoop output:

64: 8d5b ffff 3131 3931 3031 3030 3030 3032 .[..119101000 +002 80: 2e30 3130 3030 2020 2020 2020 2020 2020 .01000

=> I need to send that "0xffff" using Net::Telnet ... how can I do that ?

Thanks for your help !

Replies are listed 'Best First'.
Re: sending hexadecimal data via telnet
by tobyink (Abbot) on Aug 07, 2012 at 13:16 UTC
    perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'
Re: sending hexadecimal data via telnet
by aitap (Deacon) on Aug 07, 2012 at 13:25 UTC
    Or use pack to transform arbitrary hexademical numbers into bytes. For example:
    $ echo -n deadbeef | perl -pe's/([[:xdigit:]]{2})/pack("H2",$1)/ge' | +xxd 0000000: dead beef ....
    Sorry if my advice was wrong.
Re: sending hexadecimal data via telnet
by thundergnat (Deacon) on Aug 07, 2012 at 19:07 UTC

    "\xff" is the Telnet IAC (Interpret As Command) character. If you want to send an actual "\xff" character as data, you need to double it; "\xff\xff" Since it seems you want two "\xff" bytes in a row as data, you need to send 4 "\xff" bytes. See RFC854 pages 13-14.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://985977]
Front-paged by Corion
[Lady_Aleena]: I wish I could think of a simple script to find out what modules my modules use (if any and including my other modules) and whicch of my modules use my modules (if any).

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2017-05-26 23:59 GMT
Find Nodes?
    Voting Booth?