Search the Community
Showing results for tags 'http'.
Found 5 results
Hello i am currently trying to download files from github (and yes i know about wget) and i need to know if they exist or not (making a list of all existing files is not feasible, because there is not enough space on the disk for the list). I tried multiple things: 1. wget and filesystem.size always gave a length of 0 even for existing files 2. copying wget in my own program and setting a flag if there is a chunk works ... but not with every file (all files that exist have the same structure and length) and i need all of the existing ones them Now i tried to do it myself with internet.request() but i only get 4 files (also the empty ones) then 6 fail and 4 succeed again(see test.txt t = True and f = False). This is because of to many open connections and i do not know how to close them. The internet.close() from the wiki dose not work for some reason. (attempt to call nil) How can i detect if the file exists and close the connection after the download? test.txt: tttttffffffffttttffffffttttffffffttttffffffttttffffffttttffffffttttffffffttttfffffft internet.lua: local c = require("component") local internet = require("internet") local f = io.open("test.txt", "wb") imax = 0 xmax = 75 ymax = 180 zmax = 87 line = "" link = "https://raw.githubusercontent.com/LordNocturnus/sf-" folder = "/master/" pos = 0 i = 0 while i <= imax do xb = pos while xb <= xmax do yb = 0 while yb <= ymax do zb = 0 while zb <= zmax do print(xb,yb,zb) file = tostring(xb) .. "-" .. tostring(yb) .. "-" .. tostring(zb) .. ".mb3d" status, user = pcall(internet.request ,link .. tostring(i) .. folder .. file) print(status) print(user) -- for i,v in pairs(user) do -- print(i,v) -- end if status then line = line .. "t" else line = line .. "f" end -- internet.close() -- f = io.open(file, "wb") -- for chunk in user do -- print(chunk) -- f:write(chunk) -- end -- f:close() -- fs.remove("home/" .. file) zb = zb+1 end yb = yb+1 end xb = xb+1 end i = i+1 end f:write(line) f:close()
My first big program. It shows: -a randomized message (requested from my HTTP server, and fortune on the server side), -Computer address, used/free/all RAM, energy levels, uptime, filesystem for booting, whether the computer can do HTTP requests, -List of components available Thanks to CptMercury and payonel for some parts of the code. I will make it available through OPPM soon, but for now you will need to get it through GitHub: https://github.com/AugiteSoul/AugiteOpenComputers/blob/master/systeminfo/systeminfo.lua Feel free to send some feedback, positive or not! I will try to answer everyone.
Ever find setting up a network of computers to be a hassle? Too much distance between them? Perhaps you want to secure your communications against would-be hackers on the server, or be able to communicate with your friends/computers on another server, for that matter. Introducing MCMessaging! A full-blown solution to sending messages to other OpenComputers (ComputerCraft coming soon) over the current internet. Why reinvent the wheel with these silly networks when we already have a massive infrastructure spanning outside of the game? Stop dealing with the knitty-gritty details of being a network administrator and get back to building cool programs! I designed the lib to be simplistic, yet secure. Message me if you have any questions as I'm still learning how to make great documentation For all the files needed to get this running: https://github.com/gknova61/MCMessaging For setup instructions and getting started, refer to the README here: https://github.com/gknova61/MCMessaging/blob/master/README.md Security: Since this is communicating over the internet, the attack vectors are the normal interweb ones + server admins with a packet sniffer. Everything is sent in plaintext as most REST applications. However, my main goals in terms of security have been satisfied: 1. Stop people from intercepting/replaying traffic in-game 2. Stop one computer from pretending to be another (this is only as strong as the password you set and the way it is stored client-side, if it is stored) Note for the server I have setup: Everything you need to setup your own server to run this is on the Github repo. I will also host a demo server 220.127.116.11, which is the default server in the [typed]messages.lua[/typed] library. With that being said, in the platform's current state (spam protection not planned as it would be almost infeasible without too much user headaches), it is relatively easy to spam and overload a server by sending millions of messages. If my demo server gets abused, I will either have to add spam protection, or more likely, take it down altogether. tl;dr don't ruin pretty things, and we will have pretty things!
MPT - Minecraft Packaging Tool is another package manager goal of which is to simplify program development, and unify other package managers. WEB Interface: http://mpt.magik6k.net/ Installation: wget http://mpt.magik6k.net/api/file/mpt/usr/bin/mpt.lua /tmp/mpt.lua /tmp/mpt -S mpt rm /tmp/mpt.lua Usage: mpt -S package1 --Installs package with dependencies mpt -R package --Remove package mpt -u --Upgrade all packages mpt -v --More output mpt -h --help Web-IDE GitHub: https://github.com/magik6k/MPT2