Re: [Tutor] Pack as HEX question

2009-10-24 Thread bob gailer
Dave Angel wrote: for byte0, byte1 in itertools.izip(packed_data, itertools.cycle(packed_XorKey)): decrypt.append(chr(ord(byte0) ^ ord(byte1))) And of course that leads to: decrypt = [chr(ord(byte0) ^ ord(byte1)) for byte0, byte1 in itertools.izip(packed_data, itertools.cycle(packed_X

Re: [Tutor] Pack as HEX question

2009-10-24 Thread ALAN GAULD
EncryptString="313B372C2E2C63362E2128" > > >This is different to what I expected, it is a string of ascii bytes >representing hex values. >Is that the real format of your data? If so we need to split it into pairs and >use >int() to convert it. Or is your real data a string of bytes that happen

Re: [Tutor] Pack as HEX question

2009-10-24 Thread Tom Green
Sweet nice tip I love this list. Thank you. Mike On Sat, Oct 24, 2009 at 7:40 PM, Dave Angel wrote: > Tom Green wrote: > >> Thanks for your reply Dave. I am capturing the data off the network >> (wireshark) and saving it in WinHex for testing. I am actually building a >> socket to decrypt th

Re: [Tutor] Pack as HEX question

2009-10-24 Thread Dave Angel
Tom Green wrote: Thanks for your reply Dave. I am capturing the data off the network (wireshark) and saving it in WinHex for testing. I am actually building a socket to decrypt the data, so prior to implementing my logic in the socket, I figured I would write the algorithm in a quick script. H

Re: [Tutor] Pack as HEX question

2009-10-24 Thread Tom Green
Thanks for your reply Dave. I am capturing the data off the network (wireshark) and saving it in WinHex for testing. I am actually building a socket to decrypt the data, so prior to implementing my logic in the socket, I figured I would write the algorithm in a quick script. Here is what I have

Re: [Tutor] Pack as HEX question

2009-10-24 Thread Dave Angel
Tom Green wrote: Alan, Thanks for your response and hopefully I can clear things up. I apologize for not being more clear. I obtain the HEX encoded data from Winhex i.e. copy Hex values. The HEX encode data is very large and I simply paste it into my Python script along with the XOR key. The

Re: [Tutor] Pack as HEX question

2009-10-24 Thread Tom Green
This is what I have so far, import struct EncryptString="313B372C2E2C63362E2128" XorKey="41424344" key = struct.unpack("d", XorKey) num_ints = len(EncryptString)/11 data = struct.unpack("%dd"% num_ints,EncryptString) The above code generates an error the my string must be a string length of 16

Re: [Tutor] Pack as HEX question

2009-10-24 Thread ALAN GAULD
> Take the 4 byte XOR key. If I convert them to int with Base 16 > it takes the 4 and converts it to 0x34 when I in turn I actually need 0x41. OK, thats because int is for converting strings. You need to use struct.unpack to convert the 4 bytes into an int. You also need to figure out how man

Re: [Tutor] Pack as HEX question

2009-10-24 Thread Tom Green
Alan, Thanks for your response and hopefully I can clear things up. I apologize for not being more clear. I obtain the HEX encoded data from Winhex i.e. copy Hex values. The HEX encode data is very large and I simply paste it into my Python script along with the XOR key. The data is a string o

Re: [Tutor] Pack as HEX question

2009-10-24 Thread Alan Gauld
"Tom Green" wrote wondering if there was someway in Python to indicate that the string is a string of HEX values similar to Perl's pack. You need to be very careful in your terminology here. Is it "a string of hex values" ie a string representation of a hex value or is it a string of bytes

[Tutor] Pack as HEX question

2009-10-24 Thread Tom Green
Hello everyone, First, I wanted to thank everyone in advance for your help and any feedback is appreciated. Here is what I am trying to accomplish: I have this encrypted data that was sent across the network. The decryption is a simple XOR with a 16 byte key. I started writing a basic Python s

Re: [Tutor] Pack/Unpack hacking

2009-09-07 Thread Tino Dai
In general, xxx.pyc is the compiled Python bytecode for xxx.py, so > struct.py is the source for struct.pyc. > > Looking at struct.py, it's entire contents is > from _struct import * > from _struct import _clearcache > > This is a pretty common idiom in the std lib for modules that are > implemente

Re: [Tutor] Pack/Unpack hacking

2009-09-06 Thread Kent Johnson
On Sun, Sep 6, 2009 at 2:20 PM, Tino Dai wrote: > Hi All, > >     Hope the people in the US are having a nice Labor Day! I am looking for > the source code > for the pack/unpack functions found in the struct package. As of this email, > I have tried a > strings on the struct.pyc file. The inspecti

Re: [Tutor] Pack/Unpack hacking

2009-09-06 Thread Tim Golden
Hope the people in the US are having a nice Labor Day! I am looking for the source code for the pack/unpack functions found in the struct package. As of this email, I have tried a strings on the struct.pyc file. The inspection of the pyc file was hoping that I could find a stub to the source.

Re: [Tutor] Pack/Unpack hacking

2009-09-06 Thread Lucas Prado Melo
On Sun, Sep 6, 2009 at 3:20 PM, Tino Dai wrote: > Hi All, > > Hope the people in the US are having a nice Labor Day! I am looking for > the source code > for the pack/unpack functions found in the struct package. As of this > email, I have tried a > strings on the struct.pyc file. The inspect

[Tutor] Pack/Unpack hacking

2009-09-06 Thread Tino Dai
Hi All, Hope the people in the US are having a nice Labor Day! I am looking for the source code for the pack/unpack functions found in the struct package. As of this email, I have tried a strings on the struct.pyc file. The inspection of the pyc file was hoping that I could find a stub to the

Re: [Tutor] pack

2005-11-05 Thread Alan Gauld
Note: CC'ing tutor list to make reply visible to all. > i had to close PYTHONWIN to get out of the program. Aha! There are problems in running Tkinter inside both IDLE and Pythonwin. Basically both programs try to trap abnormal termination - which includes the GUI close messages... IMHO, to tes

Re: [Tutor] pack

2005-11-05 Thread bob
At 01:57 PM 11/5/2005, Shi Mu wrote: >when I clicked 'quit' button, >there is no response. I want to close the interface by clicking 'x', >the interface could not be closed. >i had to close PYTHONWIN to get out of the program. That is a known problem running Tkinter stuff under PythonWin. Others m

Re: [Tutor] pack

2005-11-05 Thread Shi Mu
when I clicked 'quit' button, there is no response. I want to close the interface by clicking 'x', the interface could not be closed. i had to close PYTHONWIN to get out of the program. On 11/5/05, Alan Gauld <[EMAIL PROTECTED]> wrote: > > Why the button of the following code does not work? Thank

Re: [Tutor] pack

2005-11-05 Thread Alan Gauld
> Why the button of the following code does not work? Thanks! The program works perfectly for me. Which button do you think is not working? If its the Hello one where do you expect to see the output? print always prints to stdout so you need to look in the console window not on the GUI. But othe

Re: [Tutor] pack

2005-11-04 Thread Liam Clarke
>frame = Frame(master) > self.button Sam - What do you think will happen to frame when __init__ finishes? On 11/5/05, Shi Mu <[EMAIL PROTECTED]> wrote: > Why the button of the following code does not work? Thanks! > > from Tkinter import * > > class App: > > def __init__(self, master): > >

Re: [Tutor] pack

2005-11-04 Thread Shi Mu
Why the button of the following code does not work? Thanks! from Tkinter import * class App: def __init__(self, master): frame = Frame(master) frame.pack() self.button = Button(frame, text="QUIT", fg="red", command=frame.quit) self.button.pack(side=LEFT)

Re: [Tutor] pack

2005-11-04 Thread Hugo González Monteverde
pack is a method of Tkinter widget that needs to be called in order to have it displayed with the current geometry manager(which per default is the pack method) A geometry manager is just a way for arranging widgets into a window. Another geometry manager is "grid" If you don't specify anyth

[Tutor] pack

2005-11-04 Thread Shi Mu
what does pack mean in the following code? # File: hello1.py from Tkinter import * root = Tk() w = Label(root, text="Hello, world!") w.pack() root.mainloop() ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor