Advertisement
Guest User

Untitled

a guest
Jul 30th, 2017
796
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.78 KB | None | 0 0
  1. os.loadAPI("generator")
  2. os.loadAPI("krist")
  3.  
  4. print("Welcome to PaySafeKrist\nHere, you can purchase PaySafeKrist codes.\n")
  5. print("To purchase a card, please select one of the values below.\n")
  6.  
  7. -- Array lists
  8. s1 = {" 5 \017\n","10\n","25\n","50\n","100\n","250\n","500\n","1000\n"}
  9. s2 = {" 5\n","10 \017\n","25\n","50\n","100\n","250\n","500\n","1000\n"}
  10. s3 = {" 5\n","10\n","25 \017\n","50\n","100\n","250\n","500\n","1000\n"}
  11. s4 = {" 5\n","10\n","25\n","50 \017\n","100\n","250\n","500\n","1000\n"}
  12. s5 = {" 5\n","10\n","25\n","50\n","100 \017\n","250\n","500\n","1000\n"}
  13. s6 = {" 5\n","10\n","25\n","50\n","100\n","250 \017\n","500\n","1000\n"}
  14. s7 = {" 5\n","10\n","25\n","50\n","100\n","250\n","500 \017\n","1000\n"}
  15. s8 = {" 5\n","10\n","25\n","50\n","100\n","250\n","500\n","1000 \017\n"}
  16.  
  17. sel = 1
  18. selected = false
  19. value = "not selected"
  20. while not selected do
  21. term.clear()
  22. term.setCursorPos(1,1)
  23. print("Welcome to PaySafeKrist\nHere, you can purchase PaySafeKrist codes.\n")
  24. print("To purchase a card, please select one of the values below.\n")
  25. if sel == 1 then print(table.unpack(s1))
  26. elseif sel == 2 then print(table.unpack(s2))
  27. elseif sel == 3 then print(table.unpack(s3))
  28. elseif sel == 4 then print(table.unpack(s4))
  29. elseif sel == 5 then print(table.unpack(s5))
  30. elseif sel == 6 then print(table.unpack(s6))
  31. elseif sel == 7 then print(table.unpack(s7))
  32. elseif sel == 8 then print(table.unpack(s8))
  33. end
  34. x = 9
  35. y = 6
  36. act, key = os.pullEvent("key")
  37. if key == 200 and sel > 1 then sel = sel - 1 end
  38. if key == 208 and sel < 8 then sel = sel + 1 end
  39. if key == 28 then
  40. if sel == 1 then value = 5 term.setCursorPos(x,y+1) print("Selected!") break
  41. elseif sel == 2 then value = 10 term.setCursorPos(x,y+2) print("Selected!") break
  42. elseif sel == 3 then value = 25 term.setCursorPos(x,y+3) print("Selected!") break
  43. elseif sel == 4 then value = 50 term.setCursorPos(x,y+4) print("Selected!") break
  44. elseif sel == 5 then value = 100 term.setCursorPos(x,y+5) print("Selected!") break
  45. elseif sel == 6 then value = 250 term.setCursorPos(x,y+6) print("Selected!") break
  46. elseif sel == 7 then value = 500 term.setCursorPos(x,y+7) print("Selected!") break
  47. elseif sel == 8 then value = 1000 term.setCursorPos(x,y+8) print("Selected!") break
  48. end
  49. end
  50. end
  51. -- End of selection Menu.
  52. term.setCursorPos(1,y+10)
  53. write("Communicating with server... ")
  54. sleep(0.25)
  55. print("Done.")
  56. sleep(0.5)
  57. write("Negotiating connection... ")
  58. sleep(0.1)
  59. print("Accepted!")
  60. sleep(0.5)
  61. write("Checking Krist availability... ")
  62. sleep(0.7)
  63. print("Available!")
  64. sleep(1)
  65. term.clear()
  66. term.setCursorPos(1,1)
  67.  
  68. print("-------Order Receipt-------\n")
  69. print('PSK '..value..' x1 : '..value..' KST')
  70. print('Service fees (2%): '..math.ceil(value/100*2)..' KST\n')
  71. print("---------------------------")
  72. print("Subtotal: "..value+math.ceil(value/100*2).." KST")
  73. print("---------------------------")
  74. val1 = math.random(10)
  75. val2 = math.random(10)
  76. calc = val1 + val2
  77. print("if you want to cancel the order, type 'c' in the CCCapatcha below.")
  78. write('\nCCCapatcha: '..tostring(val1).." + "..tostring(val2)..'\nSolution: ')
  79. cont = read()
  80. if tonumber(cont) == calc then print("\nSolution correct.") elseif cont == "c" then print("\nCanceling payment...") sleep(0.75) os.reboot() else error("Solution invalid") end
  81. sleep(0.5)
  82. term.clear()
  83. term.setCursorPos(1,1)
  84. print("Before continuing, we need your e-mail address \n(your code will be sent to it.).\n\nThis is to prevent abuse of our systems.\nSo we can keep track of all our customers.\n")
  85. write("Your e-mail address: ")
  86. email = read()
  87. print("\nThank you.\nE-mail addresses are required as an additional security matter.\n\nWe thank you for your trust.\n - The PaySafeKrist Team")
  88. sleep(6)
  89. write("Generating "..value.." KST PSK card... ")
  90. rawkey = generator.generate()
  91. key = krist.sha256("KRISTWALLET"..rawkey).."-000"
  92. fine = krist.auth(key)
  93. if fine == true then print("Authentication succeeded. continueing...") else printError("Could not authenticate address, destroying session...") end
  94. address = krist.generate(key)
  95. print("Done!\nLoading payment portal...")
  96. sleep(1)
  97. term.clear()
  98. term.setCursorPos(1,1)
  99. anonkey = math.random(10000) * math.random(10000)
  100. anonadd = krist.generate(krist.sha256("KRISTWALLET"..anonkey).."-000")
  101. alright = krist.auth(krist.sha256("KRISTWALLET"..anonkey).."-000")
  102. if alright == true then print("Payment address OK proceeding to checkout...") sleep(0.5) else printError("Payment address failed to authenticate, destorying sesssion...") end
  103. completed = false
  104. time = 120
  105. if krist.balance(anonadd) == nil then oldbal = 0 else oldbal = krist.balance(anonadd) end
  106. while completed == false do
  107. term.clear()
  108. term.setCursorPos(1,1)
  109. print(anonkey)
  110. print("Please send "..tostring(math.ceil(value+value/100*2)).." KST to "..tostring(anonadd).." to buy:\n'1x PSK "..tostring(value).."'.\n(Session expires after "..time.."s)")
  111. sleep(1)
  112. time = time - 1
  113. if time == 0 then completed = true end
  114. if krist.balance(anonadd) == nil then bal = 0 else bal = krist.balance(anonadd) end
  115. if bal > oldbal and bal == value+value/100*2 or bal > value+value/100*2 then
  116. write("Payment Succeeded, refilling card with "..value.." KST.")
  117. sleep(0.5)
  118. krist.transfer('official',anonkey,value,address,"Card refilled by PaySafeKrist!")
  119. write(".")
  120. sleep(0.5)
  121. krist.transfer('official',anonkey,bal-value,"PaySafeKrist.kst","Service fees for "..value.." PSK")
  122. write(".\n")
  123. -- Using my own api to send the e-mail.
  124. html = textutils.urlEncode(('<h1 style="text-align: center;">Thank you for your purchase!</h1><hr/><h2 style="text-align: left;">Your purchase has been completed successfully!</h2><p>Below, you can find your card code, together with contacting information.</p><br/><p>Your card code is: <strong>'..rawkey..'</strong> <i>(PSK '..value..' KST)</i></p><br/><p>We would like to thank you once again for your purchase!</p><p>If there is anything we can improve, please tell us!<br />You can contact us at <a href="mailto:support@lolmaker2002.bid">support@lolmaker2002.bid</a><br /> <span style="font-size: xx-small;">(We might respond with a different email, but we will clarify we are talking to you)</span></p><p><br /> </p><p><i></o>Happy shopping!</i><br/> <b> -The PaySafeKrist Team!</b></p>'))
  125. mail = http.post("http://tracking.lolmaker2002.bid/v2/email/send","apikey=5e7886a8-8fa4-40d5-92ac-548ca7e96436&to="..email.."&subject=PaySafeKrist Card Purchase.&from=paysafekrist@lolmaker2002.bid&fromName=The PaySafeKrist Team&bodyHtml="..html.."&isTransactional=true").readAll()
  126. print("Sending e-mail to "..email)
  127. checkmail = krist.decode(mail)
  128. if checkmail == nil then checkmail = { ["success"] = false} else end
  129. if checkmail.success == true then print("\nCheck your inbox!") else print("\nWe are unable to send the e-mail, Your code is: "..rawkey) end
  130. break
  131. end
  132. end
  133. -- End of PaySafeKrist Purchase Terminal.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement