Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Finding all domains...")
- rednet.open("back")
- timeout = 0.2
- getSearchResults = function()
- dnsDatabase = {[1] = {}, [2] = {}}
- resultIDs = {}
- conflict = {}
- rednet.broadcast("firewolf.broadcast.dns.list")
- local startClock = os.clock()
- while os.clock() - startClock < timeout do
- local id, i = rednet.receive(timeout)
- if id then
- if i:sub(1, 14) == "firewolf-site:" then
- i = i:sub(15, -1)
- if not i:find(" ") and i:len() < 40 then
- if not resultIDs[tostring(id)] then
- resultIDs[tostring(id)] = 1
- else
- resultIDs[tostring(id)] = resultIDs[tostring(id)] + 1
- end
- if not i:find("rdnt://") then
- i = ("rdnt://" .. i)
- end
- local x = false
- if conflict[i] then
- x = true
- table.insert(conflict[i], id)
- else
- for m, n in pairs(dnsDatabase[1]) do
- if n:lower() == i:lower() then
- x = true
- table.remove(dnsDatabase[1], m)
- table.remove(dnsDatabase[2], m)
- if conflict[i] then
- table.insert(conflict[i], id)
- else
- conflict[i] = {}
- table.insert(conflict[i], id)
- end
- end
- end
- end
- if not x and resultIDs[tostring(id)] <= 3 then
- table.insert(dnsDatabase[1], i)
- table.insert(dnsDatabase[2], id)
- end
- end
- end
- else
- break
- end
- end
- getSearchResults()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement