barwa100

Untitled

Aug 16th, 2018
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. local modem = peripheral.wrap("back")
  2. modem.open( 1 )
  3.  
  4. os.pullEvent = os.pullEventRaw
  5.  
  6. local event, modemSide, senderChannel, replyChannel, message, senderDistance = os.pullEvent("modem_message")
  7.  
  8.  
  9.  
  10. function explode(d,p)
  11. local t, ll
  12. t={}
  13. ll=0
  14. if(#p == 1) then
  15. return {p}
  16. end
  17. while true do
  18. l = string.find(p, d, ll, true) -- find the next d in the string
  19. if l ~= nil then -- if "not not" found then..
  20. table.insert(t, string.sub(p,ll,l-1)) -- Save it in our array.
  21. ll = l + 1 -- save just after where we found it for searching next time.
  22. else
  23. table.insert(t, string.sub(p,ll)) -- Save what's left in our array.
  24. break -- Break at end, as it should be, according to the lua manual.
  25. end
  26. end
  27. return t
  28. end
  29.  
  30. local vartable = explode(",",message)
  31.  
  32. if vartable[0] == "login" then
  33. local login = http.get("https://mistaken.pl/barwa/cc/login.php?login="..vartable[1].."&passwd="..vartable[2])
  34. if not login then
  35. print("Error")
  36. else
  37. local content = login.readAll()
  38. modem.transmit(replyChannel, 1, content)
  39.  
  40. end
  41. end
  42. if vartable[0] == "auth" then
  43. local login = http.get("https://mistaken.pl/barwa/cc/auth.php?hash="..vartable[1])
  44. if not login then
  45. print("Error")
  46. else
  47. local content = login.readAll()
  48. modem.transmit(replyChannel, 1, content)
  49. end
  50. end
Advertisement
Add Comment
Please, Sign In to add comment