SHOW:
|
|
- or go back to the newest paste.
| 1 | tick = 0.05 | |
| 2 | ||
| 3 | local tArgs = { ... }
| |
| 4 | if #tArgs < 1 then | |
| 5 | print("Usage: bruteforce <side>")
| |
| 6 | return | |
| 7 | end | |
| 8 | side = tArgs[1] | |
| 9 | print("Bruteforcing on "..side)
| |
| 10 | e = peripheral.wrap(side) | |
| 11 | print(e) | |
| 12 | ||
| 13 | local i = 1 | |
| 14 | local name = "" | |
| 15 | while fs.exists(name) == true do | |
| 16 | name = "logs_"..i | |
| 17 | i = i+1 | |
| 18 | end | |
| 19 | ||
| 20 | function writeLog(text) | |
| 21 | f = fs.open(name, "a") | |
| 22 | print(text) | |
| 23 | f.writeLine(text) | |
| 24 | f.close() | |
| 25 | end | |
| 26 | ||
| 27 | if peripheral.getType(side) == "ender_tank" then | |
| 28 | for a=0,15 do | |
| 29 | for b=0,15 do | |
| 30 | for c=0,15 do | |
| 31 | e.setColors(2^a,2^b,2^c) | |
| 32 | tank = e.getTankInfo()[1] | |
| 33 | if tank.contents.amount > 0 then | |
| 34 | writeLog(a..","..b..","..c..","..tank.contents.name) | |
| 35 | end | |
| 36 | end | |
| 37 | sleep(tick) | |
| 38 | end | |
| 39 | end | |
| 40 | elseif peripheral.getType(side) == "ender_chest" then | |
| 41 | for a=0,15 do | |
| 42 | for b=0,15 do | |
| 43 | for c=0,15 do | |
| 44 | e.setColors(2^a,2^b,2^c) | |
| 45 | inventory = e.getAllStacks() | |
| 46 | if #inventory > 0 then | |
| 47 | if inventory[1] ~= nil then | |
| 48 | writeLog(a..","..b..","..c..","..tostring(inventory[1].name)) | |
| 49 | else | |
| 50 | writeLog(a..","..b..","..c..",unknown") | |
| 51 | end | |
| 52 | end | |
| 53 | end | |
| 54 | sleep(tick) | |
| 55 | end | |
| 56 | end | |
| 57 | end |