daily pastebin goal
0%
SHARE
TWEET

Untitled

a guest Mar 16th, 2018 84 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. unit Unit1;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  7.   Dialogs, sSkinManager, StdCtrls, Buttons, sBitBtn, ExtCtrls, sPanel,
  8.   acArcControls, IdBaseComponent, IdComponent, IdTCPConnection,
  9.   IdTCPClient, IdHTTP, IdAntiFreezeBase, IdAntiFreeze, IniFiles, ShellAPI,
  10.   ComCtrls, sStatusBar;
  11.  
  12. type
  13.   TNetConnect = class(TForm)
  14.     sPanel1: TsPanel;
  15.     sBitBtn1: TsBitBtn;
  16.     sSkinManager1: TsSkinManager;
  17.     sBitBtn2: TsBitBtn;
  18.     sArcPreloader1: TsArcPreloader;
  19.     IdAntiFreeze1: TIdAntiFreeze;
  20.     sPanel2: TsPanel;
  21.     sBitBtn3: TsBitBtn;
  22.     sBitBtn4: TsBitBtn;
  23.     sStatusBar1: TsStatusBar;
  24.     procedure FormCreate(Sender: TObject);
  25.     procedure sBitBtn1Click(Sender: TObject);
  26.     procedure sBitBtn2Click(Sender: TObject);
  27.     procedure sBitBtn4Click(Sender: TObject);
  28.     procedure sBitBtn3Click(Sender: TObject);
  29.   private
  30.     { Private declarations }
  31.   public
  32.     { Public declarations }
  33.   end;
  34.  
  35. type
  36.   NetConfigs = record
  37.     Client: Array [0..1] of string;
  38.     Router: Array [0..1] of string;
  39.     OldClient: Array[0..1] of string;
  40.     MAC: Array [0..1] of string;
  41.     URL_Clone: string;
  42.     URL_Settings: string;
  43.     URL_RestoreMAC: string;
  44.     URL_Restore_Old: string;
  45.   end;
  46.  
  47. var
  48.   NetConnect: TNetConnect;
  49.   Configs: NetConfigs;
  50.   HTTP: TIdHttp;
  51.   Ini: TIniFile;
  52.  
  53. implementation
  54.  
  55. {$R *.dfm}
  56.  
  57. Procedure SetConfigs;
  58. begin
  59. {Configurações de dados}
  60.  
  61.   Configs.URL_Clone := 'http://192.168.1.1/userRpm/MacCloneCfgRpm.htm?mac1='+Configs.MAC[0]+'&wan=1&Save=Salvar';
  62.   Configs.URL_Settings := 'http://192.168.1.1/userRpm/PPPoECfgRpm.htm?'+
  63. 'wan=0&wantype=2&acc='+Configs.Client[0]+'&psw='+Configs.Client[1]+'&SecType=0&sta_ip=0.0.0.0&sta_mask=0.0.0.0&linktype=1&'+
  64. 'waittime=0&Save=Salvar';
  65.   Configs.URL_RestoreMAC := 'http://192.168.1.1/userRpm/MacCloneCfgRpm.htm?mac1='+Configs.MAC[1]+'&wan=1&Save=Salvar';
  66.   Configs.URL_Restore_Old := 'http://192.168.1.1/userRpm/PPPoECfgRpm.htm?'+
  67. 'wan=0&wantype=2&acc='+Configs.OldClient[0]+'&psw='+Configs.OldClient[1]+'&SecType=0&sta_ip=0.0.0.0&sta_mask=0.0.0.0&linktype=1&'+
  68. 'waittime=0&Save=Salvar';
  69.  
  70. {Configurações de Request}
  71.   HTTP := TIDHTTP.Create(nil);
  72.   HTTP.Request.Accept := 'application/json';
  73.   HTTP.Request.ContentType := 'application/json';
  74.   HTTP.Request.BasicAuthentication := true;
  75.   HTTP.Request.Username := 'admin';
  76.   HTTP.Request.Password := 'admin';
  77.   HTTP.Request.Connection  := 'keep-alive';
  78.   HTTP.Request.UserAgent   := 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.96 Safari/537.36';
  79.   HTTP.Request.AcceptEncoding := 'gzip, deflate';
  80.   HTTP.Request.AcceptLanguage := 'pt-BR,pt;q=0.8,en-US;q=0.6,en;q=0.4';
  81.   HTTP.Request.CacheControl := 'no-cache';
  82. end;
  83.  
  84. procedure LoadIni;
  85. begin
  86.   Ini := TIniFile.Create(GetCurrentDir + '\Configurations.ini');
  87.   Configs.Client[0] := Ini.ReadString('Parametros','Username', '');
  88.   Configs.Client[1] := Ini.ReadString('Parametros','Password', '');
  89.   Configs.Router[0] := Ini.ReadString('Parametros','User Router', '');
  90.   Configs.Router[1] := Ini.ReadString('Parametros','Pass Router', '');
  91.   Configs.MAC[0] := Ini.ReadString('Parametros','Mac Clone', '');
  92.   Configs.MAC[1] := Ini.ReadString('Parametros','Mac Restore', '');
  93.   Configs.OldClient[0] := Ini.ReadString('Parametros','Old Username', '');
  94.   Configs.OldClient[1] := Ini.ReadString('Parametros','Old Password', '');
  95.   Ini.Free;
  96. end;
  97.  
  98. procedure TNetConnect.FormCreate(Sender: TObject);
  99. begin
  100.   LoadIni;
  101.   SetConfigs;  
  102. end;
  103.  
  104. procedure TNetConnect.sBitBtn1Click(Sender: TObject);
  105. begin
  106.   sBitBtn2.Enabled := True;
  107.   sArcPreloader1.Animated := True;
  108.   HTTP.Get(Configs.URL_Clone);
  109.   sArcPreloader1.Text := 'Status: Cloned';
  110.   sArcPreloader1.Animated := False;
  111. end;
  112.  
  113. procedure TNetConnect.sBitBtn2Click(Sender: TObject);
  114. begin
  115.   sArcPreloader1.Animated := True;
  116.   HTTP.Get(Configs.URL_Settings);
  117.   sArcPreloader1.Text := 'Status: Success';
  118.   sArcPreloader1.Animated := False;
  119. end;
  120.  
  121. procedure TNetConnect.sBitBtn4Click(Sender: TObject);
  122. begin
  123. sArcPreloader1.Animated := True;
  124. HTTP.Get(Configs.URL_RestoreMAC);
  125. HTTP.Get(Configs.URL_Restore_Old);
  126. sArcPreloader1.Text := 'Status: Restored';
  127. sArcPreloader1.Animated := False;
  128. end;
  129.  
  130. procedure TNetConnect.sBitBtn3Click(Sender: TObject);
  131. begin
  132.   ShellExecute(Handle, nil, 'Configurations.ini' , nil, nil, SW_SHOWNORMAL);
  133. end;
  134.  
  135. end.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top