[Delphi] Codeportierung
Also ich hab jetz einen Delphicode gefunden und möchte den in PHP umsetzen, da es nur eine berechnung ist.
Nur komm ich an der stelle nicht weiter:
Was bedeutet dieser Ausdruck?:
Folgende Variablendeklaration wurde verwendet:
y ist eine zahl
Nur komm ich an der stelle nicht weiter:
Was bedeutet dieser Ausdruck?:
|
|
Quellcode |
1 2 |
i:=keys[y]; i:=chr(ord(i) xor ord(j)); |
Folgende Variablendeklaration wurde verwendet:
|
|
Quellcode |
1 2 3 |
const keys: array[0..83] of Char = (chr(243),chr(038),chr(129),chr(196),chr(057),chr(134),chr(219),chr(146),chr(113),chr(163),chr(185),chr(230),chr(083),chr(122),chr(149),chr(124),chr(000),chr(000),chr(000),chr(000),chr(000),chr(000),chr(255),chr(000),chr(000),chr(128),chr(000),chr(000),chr(000),chr(128),chr(128),chr(000),chr(255),chr(000),chr(000),chr(000),chr(128),chr(000),chr(128),chr(000),chr(128),chr(128),chr(000),chr(000),chr(000),chr(128),chr(255),chr(000),chr(128),chr(000),chr(255),chr(000),chr(128),chr(128),chr(128),chr(000),chr(085),chr(110),chr(097),chr(098),chr(108),chr(101),chr(032),chr(116),chr(111),chr(032),chr(114),chr(101),chr(115),chr(111),chr(108),chr(118),chr(101),chr(032),chr(072),chr(084),chr(084),chr(080),chr(032),chr(112),chr(114),chr(111),chr(120),chr(000)); var i,j:char; |
y ist eine zahl
hmm, den ausdrück kenn ich jetzt nicht, aber schreib mal was "j" ist dann kann man sich das vieleicht denken was das soll...
Über mich: www.heinervdm.de
Persönlich Mitteilungen an mich bitte als PN (nicht Email) hier im Forum. ICQ und Skype bitte nur in Notfällen.
Persönlich Mitteilungen an mich bitte als PN (nicht Email) hier im Forum. ICQ und Skype bitte nur in Notfällen.
Also bis auf das xor:
chr() --> Mach nen Buchstaben aus ASCII
ord() --> Mach ASCII aus nem Buchstaben
i und j sind also ascii-codes!
chr() --> Mach nen Buchstaben aus ASCII
ord() --> Mach ASCII aus nem Buchstaben
i und j sind also ascii-codes!
http://www.FireflySeason2.com
Sie wird wieder fliegen!!
Sie wird wieder fliegen!!
das ist alles klar,
die frage ist jetzt nur, wie kann ord(j) = FALSE sein...
xor = entweder oder...
deshalb will ich wissen was j ist...
die frage ist jetzt nur, wie kann ord(j) = FALSE sein...
xor = entweder oder...
deshalb will ich wissen was j ist...
Über mich: www.heinervdm.de
Persönlich Mitteilungen an mich bitte als PN (nicht Email) hier im Forum. ICQ und Skype bitte nur in Notfällen.
Persönlich Mitteilungen an mich bitte als PN (nicht Email) hier im Forum. ICQ und Skype bitte nur in Notfällen.
Zitat
Original von Nemesis
Aber da muss ja dann wieder ne Dezimalzahl rauskommen.
Es gibt keinen Unterschied zwischen der Dezimal- und der Binärdarstellung einer Zahl. 10100010 aus dem Beispiel unten ist 162 zur Basis 10.
Zitat
Original von Nemesis
Wir würde der Code in PHP aussehen?
|
|
PHP-Quelltext |
1 2 3 4 5 6 |
$keys = array(chr(243),chr(038),chr(129),chr(196),chr(057),chr(134),chr(219),chr(146),chr(113),chr(163),chr(185),chr(230),chr(083),chr(122),chr(149),chr(124),chr(000),chr(000),chr(000),chr(000),chr(000),chr(000),chr(255),chr(000),chr(000),chr(128),chr(000),chr(000),chr(000),chr(128),chr(128),chr(000),chr(255),chr(000),chr(000),chr(000),chr(128),chr(000),chr(128),chr(000),chr(128),chr(128),chr(000),chr(000),chr(000),chr(128),chr(255),chr(000),chr(128),chr(000),chr(255),chr(000),chr(128),chr(128),chr(128),chr(000),chr(085),chr(110),chr(097),chr(098),chr(108),chr(101),chr(032),chr(116),chr(111),chr(032),chr(114),chr(101),chr(115),chr(111),chr(108),chr(118),chr(101),chr(032),chr(072),chr(084),chr(084),chr(080),chr(032),chr(112),chr(114),chr(111),chr(120),chr(000));
.....
$i = keys[$y];
$i = chr(ord($i)^ord($j));
|
Delphi:
PHP:
geht aber nicht.
|
|
Quellcode |
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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
{
******* Trillian Password Stealer *********
Read The About For Info on This Program
- Tupac aka GhettoChild (Thug2pacLife@hotmail.com)
Website: [URL]http://www.sinred.com/crew/Tupac[/URL]
}
unit Trill;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,IniFiles;
type
TForm1 = class(TForm)
GroupBox1: TGroupBox;
Edit1: TEdit;
Button1: TButton;
GroupBox2: TGroupBox;
Button2: TButton;
Button3: TButton;
Button4: TButton;
ComboBox1: TComboBox;
Label1: TLabel;
OpenDialog1: TOpenDialog;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
Database: TIniFile;
implementation
uses About;
{$R *.dfm}
function HexToInt(s: string): Longword;
var
b: Byte;
c: Char;
begin
Result := 0;
s := UpperCase(s);
for b := 1 to Length(s) do
begin
Result := Result * 16;
c := s[b];
case c of
'0'..'9': Inc(Result, Ord(c) - Ord('0'));
'A'..'F': Inc(Result, Ord(c) - Ord('A') + 10);
else
raise EConvertError.Create('No Hex-Number');
end;
end;
end;
function DecryptTrill(z: integer): String;
var
i,j:char;
x,y:integer;
final,temp:string;
const
keys: array[0..83] of Char = (chr(243),chr(038),chr(129),chr(196),chr(057),chr(134),chr(219),chr(146),chr(113),chr(163),chr(185),chr(230),chr(083),chr(122),chr(149),chr(124),chr(000),chr(000),chr(000),chr(000),chr(000),chr(000),chr(255),chr(000),chr(000),chr(128),chr(000),chr(000),chr(000),chr(128),chr(128),chr(000),chr(255),chr(000),chr(000),chr(000),chr(128),chr(000),chr(128),chr(000),chr(128),chr(128),chr(000),chr(000),chr(000),chr(128),chr(255),chr(000),chr(128),chr(000),chr(255),chr(000),chr(128),chr(128),chr(128),chr(000),chr(085),chr(110),chr(097),chr(098),chr(108),chr(101),chr(032),chr(116),chr(111),chr(032),chr(114),chr(101),chr(115),chr(111),chr(108),chr(118),chr(101),chr(032),chr(072),chr(084),chr(084),chr(080),chr(032),chr(112),chr(114),chr(111),chr(120),chr(000));
begin
temp:=database.ReadString('profile '+inttostr(z),'password','');
final:='';
x:=0;
y:=0;
while x < length(temp) do
begin
j:=chr(hextoint(temp[x+1]+temp[x+2]));
i:=keys[y];
i:=chr(ord(i) xor ord(j));
final:=final+i;
x:=x+2;
y:=y+1;
end;
result:=final;
end;
procedure LoadProfiles;
var
noMore:boolean;
i:integer;
begin
form1.ComboBox1.Items.Clear;
i:=0;
noMore:=True;
Database := TIniFile.Create(form1.edit1.text);
while noMore do
begin
if Database.SectionExists('profile '+inttostr(i)) then
begin
form1.ComboBox1.Items.Add(inttostr(i)+': '+database.ReadString('profile '+inttostr(i),'name',''));
end
else noMore:=false;
inc(i);
end;
form1.ComboBox1.Text:='';
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if DirectoryExists('C:\Program Files\Trillian\users\default') then opendialog1.InitialDir:='C:\Program Files\Trillian\users\default';
if Opendialog1.Execute then
begin
edit1.Text:=opendialog1.FileName;
if FileExists(edit1.Text) then LoadProfiles;
end
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Close;
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
if combobox1.Items.Count > 0 then
begin
label1.Caption:='Password is '+DecryptTrill(combobox1.ItemIndex);
end
else ShowMessage('Nothing To Decrypt!');
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
form2.show;
end;
end.
|
PHP:
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
$keys=Array(chr(243),chr(038),chr(129),chr(196),chr(057),chr(134),chr(219),chr(146),chr(113),chr(163),chr(185),chr(230),chr(083),chr(122),chr(149),chr(124),chr(000),chr(000),chr(000),chr(000),chr(000),chr(000),chr(255),chr(000),chr(000),chr(128),chr(000),chr(000),chr(000),chr(128),chr(128),chr(000),chr(255),chr(000),chr(000),chr(000),chr(128),chr(000),chr(128),chr(000),chr(128),chr(128),chr(000),chr(000),chr(000),chr(128),chr(255),chr(000),chr(128),chr(000),chr(255),chr(000),chr(128),chr(128),chr(128),chr(000),chr(085),chr(110),chr(097),chr(098),chr(108),chr(101),chr(032),chr(116),chr(111),chr(032),chr(114),chr(101),chr(115),chr(111),chr(108),chr(118),chr(101),chr(032),chr(072),chr(084),chr(084),chr(080),chr(032),chr(112),chr(114),chr(111),chr(120),chr(000));
$x=0;
$y=0;
$final='';
while($x < strlen($temp))
{
$j=hexdec($temp[$x+0].$temp[$x+1]);
$i=$keys[$y];
$i = chr(ord($i)^ord($j));
$final.=$i;
$x=$x+2;
$y++;
}
echo $final;
|
geht aber nicht.
Ähnliche Themen
-
Sonstige Programmiersprachen »-
Delphi 7 Tutorials
(31. Dezember 2003, 18:55)
-
Archiv: Software »-
Delphi 7
(19. März 2003, 20:28)
-
PHP »-
Delphi 5.0
(8. Juli 2003, 14:36)
-
Archiv: Software »-
Delphi und Intraweb
(3. Dezember 2002, 08:18)



