By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,409 Members | 907 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,409 IT Pros & Developers. It's quick & easy.

specific type of Hex conversion

P: n/a
Hi guys,

i found a proggie, to convert packets captured (by libpcap) to hex
format...to pass them to dnet-application.

Now the proggie shows results as following:
4500003ca92e00002001c96a0a0a0a0b0a0a0a0a08007ca401 00cfb76162636465666768696a6b6c6d6e6f70717273747576 77616263646566676869

(please go to bottom for code)

While i need the result to look as follows:

\x45\x00\x00\x3c\xa9\x2e\x00\x00\x20\x01\xc9\x6a\x 0a\x0a\x0a\x0b\x0a\x0a\x0a\x0a\x08\x00\x7c\xa4\x01 \x00\xcf\xb7\x61\x62\x63\x64\x65\x66\x67\x68\x69\x 6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76 \x77\x61\x62\x63\x64\x65\x66\x67\x68\x69

I tried to manipulate the values, but it still showed the numbers as a
block of 4 (for example \x4500) instead of a block of 2 (for example
\x45\x00).

Here is the code of the proggie, maybe someone would help me align it
as i want to?

///////////////

void
print_hex(u_char *packet, u_short len)
{
int i, s_cnt;
u_short *p;

p = (u_short *)packet;
s_cnt = len / sizeof(u_short);

for (i = 0; --s_cnt >= 0; i++)
{
if ((!(i % 60)))
{
if (i != 0)
{
printf("\n");
}

}
printf("%04x", ntohs(*(p++)));

}

if (len & 1)
{
if ((!(i % 8)))
{
//printf("\n%02x\t", (i * 2));
}
printf("%02x ", *(u_char *)p);
}
printf("\n");
}
Nov 14 '05 #1
Share this Question
Share on Google+
34 Replies


P: n/a
begin Kifah Abbad:
4500003ca92e00002001c96a0a0a0a0b0a0a0a0a08007 [...]

While i need the result to look as follows:

\x45\x00\x00\x3c\xa9\x2e\x00\x00\x20\x01\xc9 [...]
Transform this:
printf("%04x", ntohs(*(p++)));
to

{ short tmp = ntohs(*(p++));
printf("\\x%02x\\x%02x", tmp >> 8, tmp & 0xFF); }

and this
printf("%02x ", *(u_char *)p);
to
printf("\\x%02x ", *(u_char *)p);


--
Für Google, Tux und GPL!
Nov 14 '05 #2

P: n/a
"Alexander Bartolich" <al*****************@gmx.at> wrote in message
news:bs************@ID-193444.news.uni-berlin.de...
(nothing, according to my newsreader)

Can you please remove the "begin Kifah Abbad:" line from
the beginning of your messages, as it is highly confusing
my newsreader, creating an attachment called "Kifah Abbad_"
which is unreadable (probably been wrongly decoded).

I can read your messages with the command to view the raw
message source (Ctrl-F3), but that is not ideal.

--
Simon.
Nov 14 '05 #3

P: n/a
On 20 Dec 2003 14:43:04 -0800, ki***@web.de (Kifah Abbad) wrote:
Hi guys,

i found a proggie, to convert packets captured (by libpcap) to hex
format...to pass them to dnet-application.

Now the proggie shows results as following:
4500003ca92e00002001c96a0a0a0a0b0a0a0a0a08007ca40 100cfb76162636465666768696a6b6c6d6e6f7071727374757 677616263646566676869

(please go to bottom for code)

While i need the result to look as follows:

\x45\x00\x00\x3c\xa9\x2e\x00\x00\x20\x01\xc9\x6a\ x0a\x0a\x0a\x0b\x0a\x0a\x0a\x0a\x08\x00\x7c\xa4\x0 1\x00\xcf\xb7\x61\x62\x63\x64\x65\x66\x67\x68\x69\ x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x7 6\x77\x61\x62\x63\x64\x65\x66\x67\x68\x69

I tried to manipulate the values, but it still showed the numbers as a
block of 4 (for example \x4500) instead of a block of 2 (for example
\x45\x00).

Here is the code of the proggie, maybe someone would help me align it
as i want to?

///////////////

void
print_hex(u_char *packet, u_short len)
{
int i, s_cnt;
u_short *p;

p = (u_short *)packet;
How do you know that the value in packet is properly aligned to be the
address of a u_short (which I assume is an unsigned short int).
s_cnt = len / sizeof(u_short);

for (i = 0; --s_cnt >= 0; i++)
{
if ((!(i % 60)))
{
if (i != 0)
{
printf("\n");
}

}
printf("%04x", ntohs(*(p++)));

}

if (len & 1)
{
if ((!(i % 8)))
{
//printf("\n%02x\t", (i * 2));
}
printf("%02x ", *(u_char *)p);
}
printf("\n");
}


<<Remove the del for email>>
Nov 14 '05 #4

P: n/a
Simon Biber wrote:
"Alexander Bartolich" <al*****************@gmx.at> wrote in message

(nothing, according to my newsreader)

Can you please remove the "begin Kifah Abbad:" line from
the beginning of your messages, as it is highly confusing
my newsreader, creating an attachment called "Kifah Abbad_"
which is unreadable (probably been wrongly decoded).


He is probably someone with the messianic impulse to expose the
shortcomings of Outhouse Expletive whenever possible. Of course,
if you got rid of that alleged newsreader you would probably have
no difficulty.

--
Chuck F (cb********@yahoo.com) (cb********@worldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!

Nov 14 '05 #5

P: n/a
Simon Biber wrote:
"Alexander Bartolich" <al*****************@gmx.at> wrote in message
news:bs************@ID-193444.news.uni-berlin.de...
(nothing, according to my newsreader)

Can you please remove the "begin Kifah Abbad:" line from
the beginning of your messages, as it is highly confusing
my newsreader, creating an attachment called "Kifah Abbad_"
which is unreadable (probably been wrongly decoded).
Have you considered getting a working newsreader?
I can read your messages with the command to view the raw
message source (Ctrl-F3), but that is not ideal.


No, it's not ideal. You shouldn't have any major difficulty finding a
newsreader that works, for free download off the Net. Or, if you have a few
decades to spare, you can wait for me to finish writing mine[1]. :-)
[1] No, I have no immediate plans to start one.

--
Richard Heathfield : bi****@eton.powernet.co.uk
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton
Nov 14 '05 #6

P: n/a
On Sun, 21 Dec 2003 13:16:40 +1100, in comp.lang.c , "Simon Biber"
<ne**@ralminNOSPAM.cc> wrote:
"Alexander Bartolich" <al*****************@gmx.at> wrote in message
news:bs************@ID-193444.news.uni-berlin.de...
(nothing, according to my newsreader)

Can you please remove the "begin Kifah Abbad:" line from
the beginning of your messages,


while I agree that starting a message with the opening remark from a
UUEncoding is unusual and probably daft, your newsreader should not
object.
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 14 '05 #7

P: n/a
Alright guys...with your help, i managed to get a decent function:

void print_hex(u_char *packet, u_short len)
{
int i, s_cnt;
u_short *p, w;

p = (u_short *)packet;
s_cnt = len / sizeof(u_short);

for (i = 0; --s_cnt >= 0; ++i, ++p)
{
if ((!(i % 60)) && i != 0)
printf("\n");
w = ntohs(*p);
printf("\\x%02x", (w>>8)&0xff);
printf("\\x%02x", w&0xff);
}

if (len & 1)
printf("\\x%02x ", *(u_char *)p);
printf("\n");
}
if (len & 1)
{
if ((!(i % 8)))
{
//printf("\n%02x\t", (i * 2));
}
printf("\\x%02x ", *(u_char *)p);
}
printf("\n");
}

I get following string as a result printed out,which is what i
intended:

\x45\x00\x00\x48\x37\x34\x00\....etc

Any1 can give me a hint, how i can save all what gets printed out,
into a char variable? i mean exactly what gets printed out,and not
part of it....is it playing with snprintf?
Nov 14 '05 #8

P: n/a
begin Kifah Abbad:
Any1 can give me a hint, how i can save all what gets printed out,
into a char variable? i mean exactly what gets printed out,and not
part of it....is it playing with snprintf?


The really easy way is to use fprintf and a temporary file.
One additional argument, trivial changes to the code.

Working with sprintf is unsafe, but not difficult to implemented.
Only additional argument, little change to the code.

char sz[0x1000];
char* buffer = sz;
buffer += sprintf(buffer, ....)
/* the next sprintf */

The Only Decent Solution (TM) with snprintf is more complicated.
First of all the return value of snprintf in case of overflow varies
through history. Unlike other things that where later on fixed by
the standard this one is so subtle that it might get unnoticed.

Anyway, the basic structure:

{ int result = snprintf(buffer, buffer_size, ...)
if (result >= buffer_size)
/* error */
buffer += result; buffer_size -= result; }

--
Für Google, Tux und GPL!
Nov 14 '05 #9

P: n/a
On 21 Dec 2003 12:46:56 GMT, in comp.lang.c , Alexander Bartolich
<al*****************@gmx.at> wrote:
begin Kifah Abbad:


Hi
Its REALLY not a good idea to start your posts with "begin". This is
the opening phrase from a uuencoded document and may confuse many
newsreaders not to mention humans.

Also, it doesn't make any sense in english. You probably mean
Kifah Abbad said:
or
Kifah Abbad began:

I don't think that even in German one can say "Anfangst Alexander". Or
maybe you can, but in English its gibberish.
Any1 can give me a hint, how i can save all what gets printed out,
into a char variable? i mean exactly what gets printed out,and not
part of it....is it playing with snprintf?


The really easy way is to use fprintf and a temporary file.


an easier way would be to use OS specific functionality to pipe stdout
to a file.

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 14 '05 #10

P: n/a
Mark McIntyre wrote:
On 21 Dec 2003 12:46:56 GMT, in comp.lang.c , Alexander Bartolich
<al*****************@gmx.at> wrote:
begin Kifah Abbad:
Hi
Its REALLY not a good idea to start your posts with "begin".


It's hardly a /bad/ idea.
This is
the opening phrase from a uuencoded document and may confuse many
newsreaders
I don't think so. I think it may confuse one particular newsreader, and I
think that may be exactly why he's doing it.
not to mention humans.


Not really. I read his article, and didn't even notice the begin-thing until
other people started pointing it out. But then, my newsreader isn't broken
(in that particular way).

--
Richard Heathfield : bi****@eton.powernet.co.uk
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton
Nov 14 '05 #11

P: n/a
"TheClap" <th******@afn.com.invalid> wrote in message
news:Xn*********************@207.14.113.17...

What's this antisemitic flood all about? Does this quaify as spam?
--
Gary
Nov 14 '05 #12

P: n/a
Alexander Bartolich <al*****************@gmx.at> wrote in message news:<bs************@ID-193444.news.uni-berlin.de>...
begin Kifah Abbad:
Any1 can give me a hint, how i can save all what gets printed out,
into a char variable? i mean exactly what gets printed out,and not
part of it....is it playing with snprintf?


The really easy way is to use fprintf and a temporary file.
One additional argument, trivial changes to the code.

Working with sprintf is unsafe, but not difficult to implemented.
Only additional argument, little change to the code.

char sz[0x1000];
char* buffer = sz;
buffer += sprintf(buffer, ....)
/* the next sprintf */


Well, i have been experminting with sprintf all day.

And concentrated on the loop:
for (i = 0; --s_cnt >= 0; ++i, ++p)
{
if ((!(i % 60)) && i != 0)
printf("\n");
w = ntohs(*p);

sprintf(stringo1,"\\x%02x", (w>>8)&0xff);
sprintf(stringo2,"\\x%02x", w&0xff);
sprintf(stringo_final,"%s%s", stringo1,stringo2);
printf("%s",stringo_final);
}

Now if pull the last line out of the loop,
(printf("%s",stringo_final);) i get as a results of the proggie:
\x68\x69 only (the last part handled by the loop).

so i need to have something, that keeps adding the strings, and
presents them out of the loop...I need to look under append string or
something like that.
Nov 14 '05 #13

P: n/a
begin followup to Kifah Abbad:
so i need to have something, that keeps adding the strings, and
presents them out of the loop...I need to look under append string or
something like that.


Please look again at my scribble of code.
Think about the return value of sprintf.
Try to imagine what "buffer += sprintf" is about.

--
Für Google, Tux und GPL!
Nov 14 '05 #14

P: n/a
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

In comp.lang.c, Gary (gl*******@comcast.net) wrote:
"TheClap" <th******@afn.com.invalid> wrote in message
news:Xn*********************@207.14.113.17...

What's this antisemitic flood all about? Does this quaify as spam?


It qualifies as off-topic braindead flood. Not that I agree or
disagree with the content of those messages, but this is surely not the
place for discussing such topics.

Followup to soc.culture.jewish just in case someone wants to
continue/start the flame far away from here.

Regards.
- --
My real e-mail address: chema (AT) chema.homelinux.org
http://EuropeSwPatentFree.hispalinux.es - EuropeSwPatentFree
I don't read HTML posts / No leo mensajes en HTML
Blog Overflow: http://chema.homelinux.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQE/5f2C9P6GbSlI+hkRAklxAKCheybrp7orfqSGI6fwbz/sfHYz7ACeOEOQ
fubvjLss1VVERNPv4mPHlIM=
=eGIT
-----END PGP SIGNATURE-----
Nov 14 '05 #15

P: n/a
On Sun, 21 Dec 2003 12:59:28 +0000, Mark McIntyre wrote:
On 21 Dec 2003 12:46:56 GMT, in comp.lang.c , Alexander Bartolich
<al*****************@gmx.at> wrote:
begin Kifah Abbad:


Hi
Its REALLY not a good idea to start your posts with "begin". This is
the opening phrase from a uuencoded document and may confuse many
newsreaders not to mention humans.


FWIW, it's generally intentional; the only known newsreader to screw up
consistently is Outlook Express, which also happens to have a few other
annoying habits. By doing this, the poster is essentially saying "If you
want to play with the big boys, get a real client."

Not condoning, just clarifying. :)
Nov 14 '05 #16

P: n/a
Kifah Abbad wrote:
.... snip ...
so i need to have something, that keeps adding the strings, and
presents them out of the loop...I need to look under append
string or something like that.


unsigned int index;
char carray[MAX];

index = 0;
while (someconditions) {
/* setup FORMAT and data etc. */
index += sprintf(&carray[index], FORMAT, data);
}

and somewhere you are ensuring that you don't overwrite carray.

--
Chuck F (cb********@yahoo.com) (cb********@worldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!
Nov 14 '05 #17

P: n/a
On Sun, 21 Dec 2003 14:13:16 +0000 (UTC), in comp.lang.c , Richard
Heathfield <do******@address.co.uk.invalid> wrote:
Mark McIntyre wrote:
On 21 Dec 2003 12:46:56 GMT, in comp.lang.c , Alexander Bartolich
<al*****************@gmx.at> wrote:
begin Kifah Abbad:
Hi
Its REALLY not a good idea to start your posts with "begin".


It's hardly a /bad/ idea.


Well, YMMV, but I tend to find that its often a nongood idea (if you
prefer that to bad) to use confusing constructs that can appear to be
other than they are, especially when writing in plain english.I don't think so. I think it may confuse one particular newsreader,
I'm just thinking how many times I've heard people argue against html
because even if it breaks only one newsreader, its still one too many.
and I
think that may be exactly why he's doing it.


Anyone who does something so childish is clearly an idiot, and not to
be taken seriously.... :-(

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 14 '05 #18

P: n/a
Mark McIntyre wrote:
On Sun, 21 Dec 2003 14:13:16 +0000 (UTC), in comp.lang.c , Richard
Heathfield <do******@address.co.uk.invalid> wrote:
Mark McIntyre wrote:
On 21 Dec 2003 12:46:56 GMT, in comp.lang.c , Alexander Bartolich
<al*****************@gmx.at> wrote:

begin Kifah Abbad:

Hi
Its REALLY not a good idea to start your posts with "begin".
It's hardly a /bad/ idea.


Well, YMMV, but I tend to find that its often a nongood idea (if you
prefer that to bad) to use confusing constructs that can appear to be
other than they are, especially when writing in plain english.


So unconfusing was this construct that I didn't even notice it when it was
first posted. I skipped right past it to the article.
I don't think so. I think it may confuse one particular newsreader,


I'm just thinking how many times I've heard people argue against html
because even if it breaks only one newsreader, its still one too many.


<shrug> That's not my reasoning at all, wrt HTML. I think it's important
that articles should be readable in a vanilla text client without the
reader having to jump through mental parsing hoops. The "begin" thing,
then, clearly isn't an issue for me, whereas HTML is far more suited to Web
browsers than to Usenet.
and I
think that may be exactly why he's doing it.


Anyone who does something so childish is clearly an idiot, and not to
be taken seriously.... :-(


Well, yes and no. I mean yes, I see your point, but on the other hand he's
drawing attention to what some people consider to be a serious flaw in one
particular newsreader. Ideally, the effect ought to be that the maintainers
of that application should fix their bug. Regrettably, this seems unlikely
to happen. Failing that, at least the practice raises awareness amongst
users of that application that the bug exists.

--
Richard Heathfield : bi****@eton.powernet.co.uk
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton
Nov 14 '05 #19

P: n/a
Simon Biber wrote:
"Alexander Bartolich" <al*****************@gmx.at> wrote in message
news:bs************@ID-193444.news.uni-berlin.de...
(nothing, according to my newsreader)

Can you please remove the "begin Kifah Abbad:" line from
the beginning of your messages, as it is highly confusing
my newsreader,


I'd suggest that you get an proper newsreader, rather than ask that everyone
else conform to the restrictions that your broken newsreader imposes.
--
Lew Pitcher

Master Codewright and JOAT-in-training
Registered Linux User #112576 (http://counter.li.org/)
Slackware - Because I know what I'm doing.

Nov 14 '05 #20

P: n/a
On 20 Dec 2003 14:43:04 -0800, ki***@web.de (Kifah Abbad) wrote:
Hi guys,

i found a proggie,


I suggest you let it go, before someone calls the SPCA.

--
Al Balmer
Balmer Consulting
re************************@att.net
Nov 14 '05 #21

P: n/a
On Sun, 21 Dec 2003 23:20:07 +0000, Mark McIntyre
<ma**********@spamcop.net> wrote:
On Sun, 21 Dec 2003 14:13:16 +0000 (UTC), in comp.lang.c , Richard
Heathfield <do******@address.co.uk.invalid> wrote:
Mark McIntyre wrote:
On 21 Dec 2003 12:46:56 GMT, in comp.lang.c , Alexander Bartolich
<al*****************@gmx.at> wrote:

begin Kifah Abbad:

Hi
Its REALLY not a good idea to start your posts with "begin".


It's hardly a /bad/ idea.


Well, YMMV, but I tend to find that its often a nongood idea (if you
prefer that to bad) to use confusing constructs that can appear to be
other than they are, especially when writing in plain english.
I don't think so. I think it may confuse one particular newsreader,


I'm just thinking how many times I've heard people argue against html
because even if it breaks only one newsreader, its still one too many.

Even when the newsreader broken is probably the leading offender in
sending html messages ;-)

--
Al Balmer
Balmer Consulting
re************************@att.net
Nov 14 '05 #22

P: n/a
On Mon, 22 Dec 2003 01:50:01 +0000 (UTC), in comp.lang.c , Richard
Heathfield <do******@address.co.uk.invalid> wrote:
So unconfusing was this construct that I didn't even notice it when it was
first posted. I skipped right past it to the article.


exactly, it confused you so muich you didn't even read the
attribution. Ha!
I'm just thinking how many times I've heard people argue against html
because even if it breaks only one newsreader, its still one too many.


<shrug> That's not my reasoning at all, wrt HTML. I think it's important
that articles should be readable in a vanilla text client without the
reader having to jump through mental parsing hoops. The "begin" thing,
then, clearly isn't an issue for me, whereas HTML is far more suited to Web
browsers than to Usenet.


I'm confused that you think that there's a difference.

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 14 '05 #23

P: n/a
On Sun, 21 Dec 2003 13:28:13 -0800, in comp.lang.c , Kelsey Bjarnason
<ke*****@lightspeed.bc.ca> wrote:
FWIW, it's generally intentional; the only known newsreader to screw up
consistently is Outlook Express, which also happens to have a few other
annoying habits.
In other words,m just pain childish.
By doing this, the poster is essentially saying "If you
want to play with the big boys, get a real client."


So I'm ok to start posting in HTML, because all "real" clients can
read it fine can't they. I see. Splendid.

Or is it, perhaps, a tiny smidgeon of childish anti-MS-ism?

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 14 '05 #24

P: n/a
begin followup to Mark McIntyre:
Or is it, perhaps, a tiny smidgeon of childish anti-MS-ism?


Amid a sea of top-posters, overlong attribution lines, outright
quote-fakers and other trolls it's amazing how long this simple
issue can drag on.

First of all, my attribution line is not a violation of the strict
no-binaries-rule. A valid uuencode block would look like this: [0]

Note the (octal) number between keyword 'begin' and the filename.
Granted, the concept of file permissions, also called 'mode', does
not make much sense on FAT, HPFS or NTFS. Still it is strange to
be so extremely liberal in accepting non-text input.

Anyway, this is a well-known bug [1] that will not get fixed.
Which leads to the secret cycle of success:

1. Software has bug, some person "exploits" bug
2. That person gets verbal abuse, but nobody else
3. Users don't switch, bug does not get fixed
4. Vendor gets profit, goto 1.

In the words of Jean-Luc Picard:
# We've made too many compromises already, too many retreats:
# They invade our space and we fall back.
# They assimilate entire worlds and we fall back. Not again.
# The line must be drawn here! This far, no farther! [...]

--
[0] http://www.opengroup.org/onlinepubs/.../uuencode.html
[1] http://support.microsoft.com/default...;EN-US;q265230

--
Für Google, Tux und GPL!
Nov 14 '05 #25

P: n/a
Mark McIntyre wrote:
On Mon, 22 Dec 2003 01:50:01 +0000 (UTC), in comp.lang.c , Richard
Heathfield <do******@address.co.uk.invalid> wrote:
So unconfusing was this construct that I didn't even notice it when it was
first posted. I skipped right past it to the article.


exactly, it confused you so muich you didn't even read the
attribution. Ha!


What makes you think I didn't read the attribution? I just didn't notice
anything odd about it, that's all.
I'm just thinking how many times I've heard people argue against html
because even if it breaks only one newsreader, its still one too many.


<shrug> That's not my reasoning at all, wrt HTML. I think it's important
that articles should be readable in a vanilla text client without the
reader having to jump through mental parsing hoops. The "begin" thing,
then, clearly isn't an issue for me, whereas HTML is far more suited to
Web browsers than to Usenet.


I'm confused that you think that there's a difference.


I'm confused that you don't see this very obvious difference.

Obviously, this conversation is going nowhere productive.

--
Richard Heathfield : bi****@eton.powernet.co.uk
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton
Nov 14 '05 #26

P: n/a
On 22 Dec 2003 10:16:28 GMT
Jew Hunter <je*@auschwitz.de> wrote:
On Mon, 22 Dec 2003 05:08:46 GMT, in
news:la***********@merlin.l6s4x6-4.ca"Lew Pitcher" said
Simon Biber wrote:
"Alexander Bartolich" <al*****************@gmx.at> wrote in message
news:bs************@ID-193444.news.uni-berlin.de...
(nothing, according to my newsreader)

Can you please remove the "begin Kifah Abbad:" line from
the beginning of your messages, as it is highly confusing
my newsreader,


I'd suggest that you get an proper newsreader, rather than ask that
everyone else conform to the restrictions that your broken
newsreader imposes.


By that line of reasoning you condone HTML messages being sent over
usenet.


No, since there is nothing broken about a news reader that does not
support HTML. The relevant RFCs specify posting in plain text, not HTML.
--
Flash Gordon
Paid to be a Geek & a Senior Software Developer
Although my email address says spam, it is real and I read it.
Nov 14 '05 #27

P: n/a
On Tue, 23 Dec 2003 00:17:46 +0000 (UTC), in comp.lang.c , Richard
Heathfield <do******@address.co.uk.invalid> wrote:
I'm confused that you think that there's a difference.
I'm confused that you don't see this very obvious difference.


Well, I guess we just have to be confused together.
Obviously, this conversation is going nowhere productive.


Yup, we're both stupidly intransigent in our muddle headed thinking.

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 14 '05 #28

P: n/a
On 23 Dec 2003 00:01:06 GMT, in comp.lang.c , Alexander Bartolich
<al*****************@gmx.at> wrote:
begin followup to Mark McIntyre:
Or is it, perhaps, a tiny smidgeon of childish anti-MS-ism?
First of all, my attribution line is not a violation of the strict
no-binaries-rule.


never said it was.
Anyway, this is a well-known bug [1] that will not get fixed.
so there's two solutions
1) pretend the bug isn't there, post stuff which will confuse said
software, causing grief and annoyance to some readers.
2) work around bug, annoying no-one.
Which leads to the secret cycle of success:
I don't give two hoots about your opinion of MS's bug fixing
capabilities. I'm only interested in whethe people can read the posts.
3. Users don't switch, bug does not get fixed
Its not your business to make people switch newsreaders. Personally I
think OE is a heap of ordure, and I use Agent which handles this
properly.
4. Vendor gets profit, goto 1.


from a *free* newsreader? Erm?
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 14 '05 #29

P: n/a
Mark McIntyre wrote:
On Tue, 23 Dec 2003 00:17:46 +0000 (UTC), in comp.lang.c , Richard
Heathfield <do******@address.co.uk.invalid> wrote:
I'm confused that you think that there's a difference.
I'm confused that you don't see this very obvious difference.


Well, I guess we just have to be confused together.


That works for me.
Obviously, this conversation is going nowhere productive.


Yup, we're both stupidly intransigent in our muddle headed thinking.


Come on, be honest - you wouldn't want it any other way. :-)

--
Richard Heathfield : bi****@eton.powernet.co.uk
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton
Nov 14 '05 #30

P: n/a
Jew Hunter wrote:
On Mon, 22 Dec 2003 05:08:46 GMT, in news:la***********@merlin.l6s4x6-4.ca
"Lew Pitcher" said

Simon Biber wrote:
"Alexander Bartolich" <al*****************@gmx.at> wrote in message
news:bs************@ID-193444.news.uni-berlin.de...
(nothing, according to my newsreader)

Can you please remove the "begin Kifah Abbad:" line from
the beginning of your messages, as it is highly confusing
my newsreader,


I'd suggest that you get an proper newsreader, rather than ask that
everyone else conform to the restrictions that your broken newsreader
imposes.

By that line of reasoning you condone HTML messages being sent over usenet.


I don't see how you can say that. I've said nothing about HTML, and although
I abhor HTML postings to text newsgroups, I neither condone nor forbid HTML
postings. OTOH, I do /not/ condone people complaining that proper postings
are somehow improper and should be forbidden when the postings conform to
usenet definition and practice.

That Simon's newsreader improperly interprets three words when placed in a
textual article points out that his newsreader is broken.

If /your/ newsreader breaks when I type in the text

<html>
<head><title>Broken Newsreader interprets text as HTML</title></head>
<body><p>A broken newsreader might interpret this as an HTML posting when
instead it is just 6 lines of text.
</body>
</html>

then you have a broken newsreader as well. Only your newsreader is broken in
a different manner than Simon's newsreader is.

--
Lew Pitcher

Master Codewright and JOAT-in-training
Registered Linux User #112576 (http://counter.li.org/)
Slackware - Because I know what I'm doing.

Nov 14 '05 #31

P: n/a
Barry Schwarz <sc******@deloz.net> wrote in message news:<bs**********@216.39.135.203>...
On 20 Dec 2003 14:43:04 -0800, ki***@web.de (Kifah Abbad) wrote:
Hi guys,

i found a proggie, to convert packets captured (by libpcap) to hex
format...to pass them to dnet-application.

Now the proggie shows results as following:
4500003ca92e00002001c96a0a0a0a0b0a0a0a0a08007ca40 100cfb76162636465666768696a6b6c6d6e6f7071727374757 677616263646566676869

(please go to bottom for code)

While i need the result to look as follows:

\x45\x00\x00\x3c\xa9\x2e\x00\x00\x20\x01\xc9\x6a\ x0a\x0a\x0a\x0b\x0a\x0a\x0a\x0a\x08\x00\x7c\xa4\x0 1\x00\xcf\xb7\x61\x62\x63\x64\x65\x66\x67\x68\x69\ x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x7 6\x77\x61\x62\x63\x64\x65\x66\x67\x68\x69

I tried to manipulate the values, but it still showed the numbers as a
block of 4 (for example \x4500) instead of a block of 2 (for example
\x45\x00).

Here is the code of the proggie, maybe someone would help me align it
as i want to?

///////////////

void
print_hex(u_char *packet, u_short len)
{
int i, s_cnt;
u_short *p;

p = (u_short *)packet;


How do you know that the value in packet is properly aligned to be the
address of a u_short (which I assume is an unsigned short int).


I think you were right about this note.

I managed to convert the packet into the way i want, and i inject it
using the libdnet library, using the simple application dnet.

dnet hex "\x45\x00\x00\x3c\xd9\x15\x00\x00\x20\x01\x99\x83\ x0a\x0a\x0a\x0b\x0a\x0a\x0a\x0a\x08\x00\x7e\x46\x0 1\x00\xce\x15\x61\x62\x63\x64\x65\x66\x67\x68\x69\ x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x7 6\x77\x61\x62\x63\x64\x65\x66\x67\x68\x69/bin/sh"
| dnet eth src 00:60:97:52:5c:d0 dst 00:50:da:51:7d:15 | dnet send
fxp1

Now it works fine,and the proxying of the icmp packets works
perfectly, just the value of the "time" in the ping session, keeps on
dropping in a mysterious way...until it reachs say 16ms...then starts
off by 600ms or so again...and so on:

Reply from 10.10.10.10: bytes=32 time=324ms TTL=48
Reply from 10.10.10.10: bytes=32 time=319ms TTL=48
Reply from 10.10.10.10: bytes=32 time=312ms TTL=48
Reply from 10.10.10.10: bytes=32 time=396ms TTL=48
..
..
..
Reply from 10.10.10.10: bytes=32 time=24ms TTL=48
Reply from 10.10.10.10: bytes=32 time=16ms TTL=48
Reply from 10.10.10.10: bytes=32 time=630ms TTL=48
Reply from 10.10.10.10: bytes=32 time=623ms TTL=48
..
..
..
..
So i porbably have some conversion problem, from the cast done in: p
= (u_short *)packet; or somwhere else :-(
Nov 14 '05 #32

P: n/a
(Crossposting removed.)

Gary Labowitz <gl*******@comcast.net> scribbled the following
on comp.lang.c:
"TheClap" <th******@afn.com.invalid> wrote in message
news:Xn*********************@207.14.113.17... What's this antisemitic flood all about? Does this quaify as spam?


Which antisemitic flood? My news server automatically filters out
binaries posts. What was it all about?

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"My absolute aspect is probably..."
- Mato Valtonen
Nov 14 '05 #33

P: n/a
Joona I Palaste wrote:
Gary Labowitz <gl*******@comcast.net> scribbled the following
"TheClap" <th******@afn.com.invalid> wrote in message

What's this antisemitic flood all about? Does this quaify as spam?


Which antisemitic flood? My news server automatically filters out
binaries posts. What was it all about?


You are lucky, and you don't want to know. It was a series of
about 15 1 meg binaries, which tied up my downlink for an
excessive time, and were then immediately deleted here.

--
Chuck F (cb********@yahoo.com) (cb********@worldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!
Nov 14 '05 #34

P: n/a
Joona I Palaste <pa*****@cc.helsinki.fi> writes:
(Crossposting removed.)

Gary Labowitz <gl*******@comcast.net> scribbled the following
on comp.lang.c:
"TheClap" <th******@afn.com.invalid> wrote in message
news:Xn*********************@207.14.113.17...

What's this antisemitic flood all about? Does this quaify as spam?


Which antisemitic flood? My news server automatically filters out
binaries posts. What was it all about?


Some moron posted a series of viciously anti-semitic cartoons on this
thread. Be glad you didn't see them.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://www.sdsc.edu/~kst>
Schroedinger does Shakespeare: "To be *and* not to be"
(Note new e-mail address)
Nov 14 '05 #35

This discussion thread is closed

Replies have been disabled for this discussion.