Autor Beitrag
fuba
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 125

Win7
D7 Ent.
BeitragVerfasst: Mi 13.02.08 21:17 
Hi erstmal und sorry wenn ich das in falsche section gepostet habe, nur hab ich nichts anderes gefunden wo das reinpassen würde.

Ich würde gerne den angefügten Python code in delphi "umwandeln"
Die soll ein script sein um bestillte texte zu entschlüsseln.

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
#!/usr/bin/env python

import binascii
import base64
from Crypto.Cipher import AES
import sys

infile = sys.argv[1]
Key = binascii.unhexlify('mein KEY zum decrypten')

IV = binascii.unhexlify('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF')
IV_Cipher = AES.new(Key,AES.MODE_ECB)
IV = IV_Cipher.encrypt(IV)

obj = AES.new(Key,AES.MODE_CFB,IV)

afile = open(infile,'r')

data = afile.read()
data = binascii.unhexlify(''.join(data.split()))
data = data.splitlines()


for link in data:
    link = base64.b64decode(link)
    link = obj.decrypt(link)
    print link

afile.close()


habe aber keine ahnung wie man das in delphi umsetzen würde, da ich null ahnung von python hab :/

verwendet wird lediglich:
[url=www.python.org]Python[/url]
und
[url=www.voidspace.org.uk...ules.shtml#pycrypto]PyCrypt[/url]

gibts da ne möglichkeit bzw jemanden der sich damit auskennt?
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Mi 13.02.08 21:21 
Für Delphi gibt es ja auch AES-Bibliotheken/Komponenten.

Ansonsten gibt es auch einen Python-Wrapper für Delphi

_________________
Markus Kinzler.
fuba Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 125

Win7
D7 Ent.
BeitragVerfasst: Mi 13.02.08 22:57 
habe nu mal die TurboPower LockBox componente installiert, nur ich hab noch immer keinen plan von dem python code...

Hab zwar schon bisschen rugespielt mit dem LockBox aber nichts rausgekommen :/

Hat wer ne idee was eigentlich bei "binascii.unhexlify" gemacht wird?
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Mi 13.02.08 23:05 
www.delphipraxis.net...c96234,previous.html

docs.python.org/lib/module-binascii.html hat folgendes geschrieben:
unhexlify( hexstr)
Return the binary data represented by the hexadecimal string hexstr. This function is the inverse of b2a_hex(). hexstr must contain an even number of hexadecimal digits (which can be upper or lower case), otherwise a TypeError is raised.


Moderiert von user profile iconNarses: URL-Tags hinzugefügt

_________________
Markus Kinzler.