:) -k
https://the-sauna.icu/prandom/?api=
* Means that endpoint has &json as an option
If you get ratelimited you'll get a response akin to this;
{
"ratelimited": true,
"left": 12,
"ip": "1.2.3.4"
}
= curl_init();
curl_setopt(, CURLOPT_URL, "https://the-sauna.icu/prandom/?api=nochars");
curl_setopt(, CURLOPT_RETURNTRANSFER, 1);
= curl_exec();
curl_close();
echo ;
import requests
r = requests.get("https://the-sauna.icu/prandom/?api=coin")
print(r.text)
Invoke-WebRequest -Uri "https://the-sauna.icu/prandom/?api"
curl -s "https://the-sauna.icu/prandom/?api=info&json" | jq
/* bad c++ below */
#include <iostream>
#include <curl/curl.h>
int main() {
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "https://the-sauna.icu/prandom/?api=nochars");
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
std::cout << res << std::endl;
return 0;
}
using System;
using System.Net;
using System.IO;
namespace RudApp0
{
class Program
{
static void Main(string[] args)
{
string url = "https://the-sauna.icu/prandom/?api=nochars";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream resStream = response.GetResponseStream();
StreamReader reader = new StreamReader(resStream);
string responseFromServer = reader.ReadToEnd();
Console.WriteLine(responseFromServer);
}
}
}
// there is also a GO version of the "algorithm" availbe at https://the-sauna.icu/prandom/rud.go
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func main() {
resp, err := http.Get("https://the-sauna.icu/prandom/?api=nochars")
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
panic(err)
}
fmt.Println(string(body))
}
require 'net/http'
require 'uri'
url = URI.parse("https://the-sauna.icu/prandom/?api=nochars")
req = Net::HTTP::Get.new(url.to_s)
res = Net::HTTP.start(url.host, url.port, :use_ssl => url.scheme == 'https') {|http|
http.request(req)
}
puts res.body
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class Main {
public static void main(String[] args) throws Exception {
URL url = new URL("https://the-sauna.icu/prandom/?api=nochars");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("GET");
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer content = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
content.append(inputLine);
}
in.close();
con.disconnect();
System.out.println(content.toString());
}
}
const https = require('https');
https.get('https://the-sauna.icu/prandom/?api=nochars', (resp) => {
let data = '';
resp.on('data', (chunk) => {
data += chunk;
});
resp.on('end', () => {
console.log(JSON.parse(data));
});
}).on("error", (err) => {
console.log("Error: " + err.message);
});
query {
coinflip
}
Obviously this is a bad source of randomness, and you should not use this for anything that requires anything cryptographically secure (passwords, etc).
Wanted to get something that'd be standardized (cough) and CURL-able.
There is no reason to use this over your own implementation of course, but it's a nice larp :)
[59899707256709]
15.541076660156
ms33894