[Tutor] Converting MAC address . Need Help

2006-02-27 Thread Sudarshana KS
Hi,

I am using scapy for writing a dhcp client. 

The problem i am facing is the mac address i have is in the form
00:11:22:33:44:55 need to convert to '\x00\x11\x22\x33\x44\x55' 
Please help me out with this problem. The chaddr field in dhcp ( SCAPY) requires '\x00\x11\x22\x33\x44\x55'  format. 

I want this to be assinged through variables. Please let me know if this i doable.

Thanks in advance,Sudarshana K S
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Urgent - Using Threads for processing each single Packet ?

2006-03-03 Thread Sudarshana KS
Hi All,

Currently i am planning for writing a tool which gets a webpage and
fills the appropriate fields and posts the page back to the server.
The problem is that i am using SCAPY for doing http as i need VLAN TAG
to be supported to get the HTTP Page.

So before starting this i had couple of questions.

1. As we need to establish a TCP session for http to work , do we need
to process each packet as a seperate thread ? I am not sure how the
system would respond if we have to get 500 webpages - in the sense the
total number of tcp connection is around 500 . Could any body tell me
what would be best design ? Using each thread for single packet
processing is it worth ?

2. Is there any specific tool or any built in APIs which can parse
Http part of the packet ?

Please help me .
Thanks in advance,

Sudarshana K S
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Converting \x0e to string 0e in python

2007-02-08 Thread Sudarshana KS

Hi,

Currently i have data with the following type - Which is a x509 certificate
obtained from SSL server done. I need this to be converted to normal string,
so that i can use the load_certificate method of OpenSSL, which takes string
as the argument.

Kindly help me.


cert=
'\x00\x01\xa20\x82\x01\x9e0\x82\x01(\x02\x01\x000\r\x06\t*\x86H\x86\xf7\r\x01\x01\x04\x05\x000:1
\x120\x10\x06\x03U\x04\x03\x13\tConst2-
2.1$0\n\x06\x03U\x04\x05\x13\x0339B0\x16\x06\t*\x86H\x86\xf7\r
\x01\t\x02\x16\tConst2-
2.0\x1e\x17\r070207210438Z\x17\r170204210438Z0:1\x120\x10\x06\x03U\x04\x03
\x13\tConst2-
2.1$0\n\x06\x03U\x04\x05\x13\x0339B0\x16\x06\t*\x86H\x86\xf7\r\x01\t\x02\x16\tConst2-2.0|0\r
\x06\t*\x86H\x86\xf7\r\x01\x01\x01\x05\x00\x03k\x000h\x02a\x00\xc2\x99e2\xd0\xa5\xb67\x80iv.\x12I\x17
\xaa\xee9S\xdc\xee\xa1!\xb4\x94/\xf8\xe2\x0e%V\xdc\xa8%\x04\x03\x8dl\\\x8cJ\xec\x13\xd7\xe2\x96\x1b\xa8`
\xdf$\xfe\xb9\x9a\xf9\xb7[\x8f\xe6\xc7U?&l\x04D\xfc\xd7\x96\x99\x04\xb1\x8c\xcd\xc3[\x17\xba\xb2+g5L
\x08~3B\xf9\x1dV\x1a\x84\x0eW\x94\x1f\x02\x03\x01\x00\x010\r\x06\t*\x86H\x86\xf7\r\x01\x01\x04\x05
[EMAIL PROTECTED]<\xae\xc7\xf6l\xeam2\x8f[Z\xde\xd0\xbf\xd7\xd1/
[EMAIL PROTECTED]
\x88\xce|v\xb2\xc35#\xc5\xa7\xec\xdca\x12\xd8*\xc3k\xf8\x911}!\x861\xe2;\xd7'


--
Regards,
Sudarshana K S
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Converting \x0e to string 0e in python

2007-02-09 Thread Sudarshana KS

Thanks for your reply.

The following is the error message :


a

'\x00\x01\xa20\x82\x01\x9e0\x82\x01(\x02\x01\x000\r\x06\t*\x86H\x86\xf7\r\x01\x01\x04\x05\x000:1\x120\x10\x06\x03U\x04\x03\x13\tConst2-
2.1$0\n\x06\x03U\x04\x05\x13\x0339B0\x16\x06\t*\x86H\x86\xf7\r\x01\t\x02\x16\tConst2-2.0\x1e\x17\r070207210438Z\x17\r170204210438Z0:1\x120\x10\x06\x03U\x04\x03\x13\tConst2-2.1$0\n\x06\x03U\x04\x05\x13\x0339B0\x16\x06\t*\x86H\x86\xf7\r\x01\t\x02\x16\tConst2-2.0|0\r\x06\t*\x86H\x86\xf7\r\x01\x01\x01\x05\x00\x03k\x000h\x02a\x00\xc2\x99e2\xd0\xa5\xb67\x80iv.\x12I\x17\xaa\xee9S\xdc\xee\xa1!\xb4\x94/\xf8\xe2\x0e%V\xdc\xa8%\x04\x03\x8dl\\\x8cJ\xec\x13\xd7\xe2\x96\x1b\xa8`\xdf$\xfe\xb9\x9a\xf9\xb7
[\x8f\xe6\xc7U?&[EMAIL PROTECTED]<\xae\xc7\xf6l\xeam2\x8f[
Z\xde\xd0\xbf\xd7\xd1/[EMAIL PROTECTED]
\x97\x02\x887\xcb\xf6#hNIG\xdb\x10\xe5A\x04\x19~8\x7f\xf3T\xaf\xdeY%\xc5if\xe4\x88\xce|v\xb2\xc35#\xc5\xa7\xec\xdca\x12\xd8*\xc3k\xf8\x911}!\x861\xe2;\xd7'

crypto.load_certificate(crypto.FILETYPE_PEM,a)

Traceback (most recent call last):
 File "", line 1, in ?
OpenSSL.crypto.Error: [('PEM routines', 'PEM_read_bio', 'no start line')]




Could you please let me know what needs to be done.

Thanks in advance,
Sudks


On 2/9/07, Kent Johnson < [EMAIL PROTECTED] > wrote:


Sudarshana KS wrote:
> Hi,
>
> Currently i have data with the following type - Which is a x509
> certificate obtained from SSL server done. I need this to be converted
> to normal string, so that i can use the load_certificate method of
> OpenSSL, which takes string as the argument.

The below data is a string. It contains lots of non-ascii values which
are printed as \x escapes, but it is still a string. Have you tried
passing it to load_certificate? What happened?

Kent

>
> Kindly help me.
>
>
> cert=
>
'\x00\x01\xa20\x82\x01\x9e0\x82\x01(\x02\x01\x000\r\x06\t*\x86H\x86\xf7\r\x01\x01\x04\x05\x000:1

> \x120\x10\x06\x03U\x04\x03\x13\tConst2-
2.1$0\n\x06\x03U\x04\x05\x13\x0339B0\x16\x06\t*\x86H\x86\xf7\r
>
> \x01\t\x02\x16\tConst2-
2.0\x1e\x17\r070207210438Z\x17\r170204210438Z0:1\x120\x10\x06\x03U\x04\x03
> \x13\tConst2-
2.1$0\n\x06\x03U\x04\x05\x13\x0339B0\x16\x06\t*\x86H\x86\xf7\r\x01\t\x02\x16\tConst2-2.0|0\r
>
\x06\t*\x86H\x86\xf7\r\x01\x01\x01\x05\x00\x03k\x000h\x02a\x00\xc2\x99e2\xd0\xa5\xb67\x80iv.\x12I\x17

>
>
\xaa\xee9S\xdc\xee\xa1!\xb4\x94/\xf8\xe2\x0e%V\xdc\xa8%\x04\x03\x8dl\\\x8cJ\xec\x13\xd7\xe2\x96\x1b\xa8`
>
\xdf$\xfe\xb9\x9a\xf9\xb7[\x8f\xe6\xc7U?&l\x04D\xfc\xd7\x96\x99\x04\xb1\x8c\xcd\xc3[\x17\xba\xb2+g5L

>
\x08~3B\xf9\x1dV\x1a\x84\x0eW\x94\x1f\x02\x03\x01\x00\x010\r\x06\t*\x86H\x86\xf7\r\x01\x01\x04\x05
>
>
[EMAIL PROTECTED]<\xae\xc7\xf6l\xeam2\x8f[Z\xde\xd0\xbf\xd7\xd1/

>
[EMAIL PROTECTED]
>
\x88\xce|v\xb2\xc35#\xc5\xa7\xec\xdca\x12\xd8*\xc3k\xf8\x911}!\x861\xe2;\xd7'
>
>
>
> --
> Regards,
> Sudarshana K S
>
>
> 
>
> ___
> Tutor maillist  -   Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor






--
Regards,
Sudarshana K S
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor