SHOW:
|
|
- or go back to the newest paste.
1 | - | local side = 'back' |
1 | + | local side = 'back' --Define rednet side |
2 | - | local IDblack = {'6', '7'} |
2 | + | local IDblack = {6, 7} --All blacklisted IDs |
3 | - | local black = {'Firewolf', 'DNS'} |
3 | + | local black = {'Firewolf', 'DNS'} --All blacklisted messages |
4 | ||
5 | - | rednet.open(side) |
5 | + | rednet.open(side) --Open rednet |
6 | ||
7 | - | id, msg = rednet.receive() |
7 | + | id, msg = rednet.receive() --Receive the message |
8 | ||
9 | - | if msg == black and id == IDBlack |
9 | + | local detected = false --Define a new variable called detected |
10 | - | then |
10 | + | |
11 | print("ID = " .. id) | |
12 | print("msg = " .. msg) | |
13 | ||
14 | for i=1,#IDblack do --Do the following block of code Length of IDblack times. i stores the current run. | |
15 | print("IDBLACK" .. IDblack[i]) | |
16 | if id == IDblack[i] then --If the current run found that IDblack contains an ID then do the following block of code | |
17 | for j=1,#black do --Do the following block of code amount of entries in black times. | |
18 | print("black" .. black[j]) | |
19 | if msg == black[j] then --If current run found that black contains the sent message then | |
20 | detected = true --Set detected to true | |
21 | print("Detected") | |
22 | break --And exit the loop | |
23 | end | |
24 | end | |
25 | end | |
26 | if detected == true then | |
27 | break | |
28 | end | |
29 | end | |
30 | ||
31 | if detected == true then --Do the alerting only if detected was set to true. | |
32 | print('Blocked ID: '..id..' Detected... Denying Access') | |
33 | rednet.send(id, 'You Are Blacklisted!') | |
34 | end |