
 local file = io.open (m_simpleTV.MainScriptDir .. "user/tvplaylists/misc/masscan/sibirsvr.txt")   
 if file == nil then return end
       
 local out=''
       
for line in file:lines() do
local port,ip = line:match('open tcp (.-) (.-) ')
  if ip then
     out = out .. ip .. ' \n'
 end
end
 file:close()
 --  

 file = io.open (m_simpleTV.MainScriptDir .. "user/tvplaylists/misc/masscan/scan.tmp" , "w+")
 if file==nil then return end
 file:write(out)
 file:close()

 local tmp = m_simpleTV.MainScriptDir .. "user\\tvplaylists\\misc\\masscan\\scan.tmp" 
 local path = m_simpleTV.MainScriptDir .. 'user\\tvplaylists\\misc\\masscan\\'
 local conf  = m_simpleTV.MainScriptDir .. 'user\\tvplaylists\\misc\\masscan\\sibir.conf'

 local fhandle = io.open (conf)
 if conf == nil then m_simpleTV.OSD.ShowMessage_UTF8('Sibir error',255,5) return end
 local str = fhandle:read('*a')
 fhandle:close()

 local ports = str:match('ports = (.-)\n')
 if ports == nil then return end
 --debug_in_file(ports)

 local shell = os.getenv('COMSPEC')
 if shell==nil then return end
 shell = m_simpleTV.Common.string_toUTF8(shell)
 if shell==nil then return end
 m_simpleTV.OSD.ShowMessage("Sibir: Check servers\nWait until the check is complete " ,0xFF00,5)

--CREATE_NO_WINDOW FLAG 0x08000000
 local processid = m_simpleTV.Common.Execute (shell, '/C cd /d "' .. path .. '" &masscan.exe -p ' .. ports .. ' -iL "' .. tmp .. '" -oL sibirsvr.txt --wait 5',0x08000000,1)
 if processid == nil then m_simpleTV.OSD.ShowMessage_UTF8('Masscan error',255,5) return end

m_simpleTV.OSD.ShowMessage("Sibir: Check completed " ,0xFF00,3)
m_simpleTV.User.Sibir.LastCheckServer = 1
os.remove(tmp)
