Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Hex conversion help for the interfaces file...

182 views
Skip to first unread message

Mike Pickard

unread,
Nov 20, 2000, 3:00:00 AM11/20/00
to
I'm trying to figure out what port my database is accepting queries
on...
A quick peek in the interfaces file reveals:

master tli tcp /dev/tcp \x00021004ac1004100000000000000000
query tli tcp /dev/tcp \x00021004ac1004100000000000000000

What do the hex values mean ??
(or can someone point me in the direction of a good converter ?)

Cheers,
--
M Pickard,
Developer, NettGain Solutions Ltd.
www.mandoforms.com

DISCLAIMER: This e-mail contains proprietary information some or all of
which may be legally privileged. It is for the intended recipient
only.If an addressing or transmission error has misdirected this e-mail,
please notify the author by replying to this e-mail. If you are not the
intended recipient you must not use, disclose, distribute, copy, print,
or rely on this e-mail.


Michael Peppler

unread,
Nov 20, 2000, 3:00:00 AM11/20/00
to
In article <3A19749A...@mandoforms.com>, "Mike Pickard"
<mi...@mandoforms.com> wrote:

> I'm trying to figure out what port my database is accepting queries
> on... A quick peek in the interfaces file reveals:
>
> master tli tcp /dev/tcp \x00021004ac1004100000000000000000 query tli tcp
> /dev/tcp \x00021004ac1004100000000000000000
>
> What do the hex values mean ??

0002 - I don't know (maybe a version number?)
1004 - the port (4100 in decimal)
ac 10 04 10 - the ip address (172.16.4.16 if I'm not mistaken)

> (or can someone point me in the direction of a good converter ?)

Here's a little perl script - feed it an interfaces file and it will
decode each entry.

#!/usr/local/bin/perl -w

use strict;

my $server;
my @dat;
my ($port, $ip);
while(<>) {
next if /^\s*$/;
next if /^\s*\#/;
chomp;
if(/^\w/) {
$server = $_;
$server =~ s/\s*$//;
next;
}
@dat = split(' ', $_);
($port, $ip) = parseAddress($dat[4]) if $dat[4] =~ /\\x[\da-f]+/;
print "$server - $dat[0] on port $port, host $ip\n";
}

sub parseAddress {
my $addr = shift;

my $port;
my $ip;

my (@arr) = (hex(substr($addr, 10, 2)), hex(substr($addr, 12, 2)),
hex(substr($addr, 14, 2)), hex(substr($addr, 16, 2)));
$port = hex(substr($addr, 6, 4));
$ip = join('.', @arr);

($port, $ip);
}

Michael
--
Michael Peppler - Data Migrations Inc. - mpep...@peppler.org
http://www.mbay.net/~mpeppler - mpep...@mbay.net - AIM MPpplr
International Sybase User Group - http://www.isug.com
Sybase on Linux mailing list: ase-lin...@isug.com

Mike Pickard

unread,
Nov 21, 2000, 3:00:00 AM11/21/00
to
Mike Pickard wrote:

> I'm trying to figure out what port my database is accepting queries

> on...[snip]

Problem solved thanks to Windows calculator (doh!)

--
Michael Pickard,
Developer, NettGain Solutions Ltd.
Williams House, Manchester Science Park, Manchester, M15 6SE, United
Kingdom.

Daniel S. Lewart

unread,
Nov 27, 2000, 3:00:00 AM11/27/00
to
"Michael Peppler" <mpep...@peppler.org> writes:

> > master tli tcp /dev/tcp \x00021004ac1004100000000000000000
> > query tli tcp /dev/tcp \x00021004ac1004100000000000000000
> > What do the hex values mean ??

> 0002 - I don't know (maybe a version number?)

Network protocol (2 for INET).

> Here's a little perl script - feed it an interfaces file and it will
> decode each entry.

And here is a littler one.

Cheers,
Daniel Lewart
d-le...@uiuc.edu
-------------------------------------------------------------------------------
#!/usr/local/bin/perl -w

use strict;

my $server;
while (<>) {
next if /^\s*$/ || /^\s*#/;
if (/^\w/) {
s/\s+$//;
$server = $_;
next;
}
my ($service_type, $api, $protocol, $device, $address) = split;
my ($addr1, $addr2) = $address =~ /^\\x0002(.{4})(.{8})/;

my @arr = map(hex, $addr2 =~ /^(..)(..)(..)(..)/);
my $port = hex($addr1);
my $ip = join('.', @arr);

print "$server - $service_type on port $port, host $ip\n";
}
-------------------------------------------------------------------------------

Daniel S. Lewart

unread,
Nov 28, 2000, 3:00:00 AM11/28/00
to
d-le...@uiuc.edu (Daniel S. Lewart) writes:

> And here is a littler one.

And below is a better one.

Cheers,
Daniel Lewart
d-le...@uiuc.edu
-------------------------------------------------------------------------------
#!/usr/local/bin/perl -w

use strict;

my $server;
while (<>) {

next if /^\s*(#|$)/;
if (/^([A-Za-z][\d\w]*)/) {
$server = $1;

0 new messages