[CRLFAWFULLY SOLVED] To telnet or to netcat... that's the question

NOSpaze nospaze at gmail.com
Sat Sep 1 04:09:00 UTC 2012


Would I believe? Works with CRLF.

# hexdump -C atest 
00000000  6e 63 20 31 32 37 2e 30  2e 30 2e 31 20 35 30 33  |nc 127.0.0.1 503|
00000010  38 20 3c 3c 20 45 4f 46  0a 41 63 74 69 6f 6e 3a  |8 << EOF.Action:|
00000020  20 4c 6f 67 69 6e 0a 41  63 74 69 6f 6e 49 44 3a  | Login.ActionID:|
00000030  20 31 0a 55 73 65 72 6e  61 6d 65 3a 20 79 6f 75  | 1.Username: you|
00000040  77 61 6e 6e 61 0a 53 65  63 72 65 74 3a 20 75 77  |wanna.Secret: uw|
00000050  61 6e 6e 61 0a 0a 45 4f  46 0a                    |anna..EOF.|
0000005a
# ./atest 
Asterisk Call Manager/1.0

# sed -i 's/$/\x0d/g' atest 

# ./atest 
Asterisk Call Manager/1.0
Response: Success
ActionID: 1
Message: Authentication accepted

# hexdump -C atest 
00000000  6e 63 20 31 32 37 2e 30  2e 30 2e 31 20 35 30 33  |nc 127.0.0.1 503|
00000010  38 20 3c 3c 20 45 4f 46  0d 0a 41 63 74 69 6f 6e  |8 << EOF..Action|
00000020  3a 20 4c 6f 67 69 6e 0d  0a 41 63 74 69 6f 6e 49  |: Login..ActionI|
00000030  44 3a 20 31 0d 0a 55 73  65 72 6e 61 6d 65 3a 20  |D: 1..Username: |
00000040  79 6f 75 77 61 6e 6e 61  0d 0a 53 65 63 72 65 74  |youwanna..Secret|
00000050  3a 20 75 77 61 6e 6e 61  0d 0a 0d 0a 45 4f 46 0d  |: uwanna....EOF.|
00000060  0a                                                |.|
00000061

The worst thing I come to realize is this: telnet SENDS CRLF!!!

06:00:11.927209 IP localhost.localdomain.44435 > localhost.localdomain.5038: P 29:49(20) ack 28 win 257 <nop,nop,timestamp 653686240 653686240>
	0x0000:  4510 0048 5fef 4000 4006 dcae 7f00 0001  E..H_. at .@.......
	0x0010:  7f00 0001 ad93 13ae 756b 0cc0 754b aa5a  ........uk..uK.Z
	0x0020:  8018 0101 fe3c 0000 0101 080a 26f6 75e0  .....<......&.u.
	0x0030:  26f6 75e0 5573 6572 6e61 6d65 3a20 796f  &.u.Username:.yo
	0x0040:  7577 616e 6e61 0d0a                      uwanna..

Please hate CRLF. Why google has just few "CRLF sucks" entries? I will call my bad dog CRLF even if he bites me.




More information about the users mailing list