Daily Archives: February 27, 2013

Decrypting RSDF files

A small code-snippet to decrypt links from a RSDF container:

def decryptRSDF(filename):
    from Crypto.Cipher import AES

    links = []

    f = open(filename, "r")
    lines = f.readlines()
    f.close()

    data = bytearray.fromhex("".join(lines))
    array = data.split("\n")

    key = bytearray.fromhex("8C35192D964DC3182C6F84F3252239EB4A320D2500000000")
    iv = bytearray.fromhex("a3d5a33cb95ac1f5cbdb1ad25cb0a7aa")

    aes_context = AES.new(str(key), AES.MODE_ECB, str(iv))

    for line in array:
        url_in = base64.b64decode(line)
        length = len(url_in)

        if length > 0:
            url_input = bytearray(url_in)
            url_output = bytearray(length)

            #1 byte
            output_block = bytearray(aes_context.encrypt(str(iv)))

            url_output[0] = url_input[0] ^ output_block[0]

            #other bytes
            for n in range(1, length+1):
                iv[:15] = iv[1:]
                iv[15] = url_input[n-1]

                if n < length:
                    output_block = bytearray(aes_context.encrypt(str(iv)))
                    url_output[n] = url_input[n] ^ output_block[0]

            links.append(str(url_output))

    return links
VN:F [1.9.22_1171]
Rating: 3.0/10 (1 vote cast)

PyQt4 QFileDialog freezes when qt4reactor is running

To use the twisted reactor inside a Qt gui application, I’m using the qt4reactor package:

app = QtGui.QApplication(sys.argv)

import qt4reactor
qt4reactor.install()

from twisted.internet import reactor
factory = Factory()

gui = Gui(app)

gui.show()
reactor.runReturn()

sys.exit(app.exec_())

But I realized that after the “reactor.runReturn()” line, each QFileDialog freezes the complete program.

filename = QtGui.QFileDialog.getOpenFileName()

A solution is to use the non-native dialog instead:

filename = QtGui.QFileDialog.getOpenFileName(options=QtGui.QFileDialog.DontUseNativeDialog)
VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
Wir benutzen Cookies um die Nutzerfreundlichkeit der Webseite zu verbessen. Durch Deinen Besuch stimmst Du dem zu.