Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #9180

parsing packets

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!selfless.tophat.at!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <tyler@tysdomain.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'character,': 0.07; 'twisted,': 0.07; 'type,': 0.07; 'bytes,': 0.09; 'function),': 0.09; 'subject:parsing': 0.09; 'username,': 0.09; 'bits,': 0.16; 'connect.': 0.16; 'designate': 0.16; 'from:addr:tyler': 0.16; 'from:addr:tysdomain.com': 0.16; 'from:name:littlefield, tyler': 0.16; 'message-id:@tysdomain.com': 0.16; 'out?': 0.16; 'packet': 0.16; 'received:69.164': 0.16; 'received:69.164.206': 0.16; 'received:69.164.206.65': 0.16; 'received:tds-solutions.net': 0.16; 'reply-to:addr:tyler': 0.16; 'reply-to:addr:tysdomain.com': 0.16; 'this:': 0.16; 'url:blog': 0.16; 'bytes': 0.19; 'blog:': 0.22; 'tells': 0.22; 'all:': 0.23; 'null': 0.23; 'parse': 0.23; 'values.': 0.23; 'byte': 0.25; "i'm": 0.27; 'server': 0.29; 'character.': 0.30; 'construct': 0.30; 'version': 0.30; 'notes': 0.31; 'to:addr:python-list': 0.34; 'header:User-Agent:1': 0.34; 'there': 0.34; 'curious': 0.35; 'passed': 0.37; 'using': 0.37; 'another': 0.38; 'received:192': 0.38; 'something': 0.38; 'two': 0.38; 'put': 0.38; 'to:addr:python.org': 0.39; 'setup': 0.40; 'kind': 0.60; 'url:net': 0.61; 'back': 0.63; 'care,': 0.68; 'receive': 0.68; 'header:Reply-To:1': 0.71; 'reply-to:no real name:2**0': 0.72; 'website:': 0.75
X-Spam-Checker-Version SpamAssassin 3.3.1 (2010-03-16) on wuff
X-Spam-Level
X-Spam-Status No, score=-1.0 required=5.0 tests=ALL_TRUSTED autolearn=unavailable version=3.3.1
Date Sun, 10 Jul 2011 14:59:29 -0600
From "Littlefield, Tyler" <tyler@tysdomain.com>
User-Agent Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.18) Gecko/20110616 Lightning/1.0b2 Thunderbird/3.1.11
MIME-Version 1.0
To python-list@python.org
Subject parsing packets
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
Reply-To tyler@tysdomain.com
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.848.1310331905.1164.python-list@python.org> (permalink)
Lines 32
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1310331905 news.xs4all.nl 21775 [2001:888:2000:d::a6]:33169
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:9180

Show key headers only | View raw


Hello all:
I'm working on a server that will need to parse packets sent from a 
client, and construct it's own packets.
The setup is something like this: the first two bytes is the type of the 
packet.
So, lets say we have a packet set to connect. There are two types of 
connect packet: a auth packet and a connect packet.
The connect packet then has two bytes with the type, another byte that 
notes that it is a connect packet, and 4 bytes that contains the version 
of the client.
The auth packet has the two bytes that tells what packet it is, one byte 
denoting that it is an auth packet, then the username, a NULL character, 
and a password and a NULL character.

With all of this said, I'm kind of curious how I would 1) parse out 
something like this (I am using twisted, so it'll just be passed to my 
Receive function), and how I get the length of the packet with multiple 
NULL values. I'm also looking to build a packet and send it back out, is 
there something that will allow me to designate two bytes, set 
individual bits, then put it altogether in a packet to be sent out?

-- 

Take care,
Ty
my website:
http://tds-solutions.net
my blog:
http://tds-solutions.net/blog
skype: st8amnd127
My programs don't have bugs; they're randomly added features!

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

parsing packets "Littlefield, Tyler" <tyler@tysdomain.com> - 2011-07-10 14:59 -0600
  Re: parsing packets Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2011-07-11 14:05 +0200

csiph-web