done
|
@ -0,0 +1,7 @@
|
||||||
|
Copyright © 2022 lolcatw
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -0,0 +1,28 @@
|
||||||
|
# Mumble ping API
|
||||||
|
A simple PHP module to ping mumble serbers.
|
||||||
|
|
||||||
|
## How to install
|
||||||
|
1. Run this thing: `git clone https://git.lolcat.ca/lolcat/mumble-ping/`
|
||||||
|
2. Download the latest release of geoip2.phar: https://github.com/maxmind/GeoIP2-php/releases
|
||||||
|
3. Sign up for maxmind's bullshit site and get the **country** GeoLite2 .mmdb file
|
||||||
|
4. Make sure curl is installed. `sudo apt install curl php-curl` should set everything up.
|
||||||
|
5. Drop all the shit you downloaded in the root of this repo
|
||||||
|
|
||||||
|
Now, just drop all of that crap inside a webserber that supports PHP and access the mumble.php file.
|
||||||
|
Don't forget to make mumble-scrape inaccessible!
|
||||||
|
|
||||||
|
To be able to show users the serber name and website, you need to scrape the official mumble serber list using mumble-scrape.php. This repo comes with a pre-compiled list.json, but it is probably outdated. Use `screen` and run mumble-scrape.php in the background. By default, it gets a list of all serbers every 24 hours and resolves the DNS for all domains!
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
`/mumble.php?ip=lolcat.ca`
|
||||||
|
or
|
||||||
|
`/mumble.php?ip=skyn3t.in&port=64738`
|
||||||
|
|
||||||
|
or for banners: `/banner.php?ip=aaathats3as.com`
|
||||||
|
|
||||||
|
So yeah, the port is optional. IPs and port is sanitized.
|
||||||
|
|
||||||
|
## Try it out
|
||||||
|
https://lolcat.ca/mumble_ping_api/
|
||||||
|
|
||||||
|
Enjoy!!
|
|
@ -0,0 +1,125 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
include "mumble-ping.php";
|
||||||
|
|
||||||
|
// load
|
||||||
|
try{
|
||||||
|
$mumble = new mumble("GeoLite2-Country.mmdb");
|
||||||
|
|
||||||
|
$res = $mumble->ping(
|
||||||
|
$_GET["ip"],
|
||||||
|
isset($_GET["port"]) ? $_GET["port"] : 64738,
|
||||||
|
);
|
||||||
|
|
||||||
|
if($res["server"]["name"] !== null){
|
||||||
|
|
||||||
|
$str = $res["server"]["name"];
|
||||||
|
}else{
|
||||||
|
|
||||||
|
$str = "Unknown serber name!!";
|
||||||
|
|
||||||
|
if(isset($_GET["name"])){
|
||||||
|
|
||||||
|
$str = $_GET["name"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}catch(Exception $error){
|
||||||
|
|
||||||
|
$ip = isset($_GET["ip"]) ? $_GET["ip"] : "Unknown address";
|
||||||
|
$port = isset($_GET["port"]) ? $_GET["port"] : "???";
|
||||||
|
|
||||||
|
http_response_code(404);
|
||||||
|
$res = [
|
||||||
|
"server" => [
|
||||||
|
"online" => "0",
|
||||||
|
"max" => "0",
|
||||||
|
"domains" => [ $ip ],
|
||||||
|
"port" => $port,
|
||||||
|
"country" => [
|
||||||
|
"code" => "blank"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
$str = "Host unreachable!!";
|
||||||
|
}
|
||||||
|
|
||||||
|
$im = new Imagick();
|
||||||
|
$im->newImage(468, 60, "#282828");
|
||||||
|
$im->setImageFormat("png");
|
||||||
|
|
||||||
|
// bg
|
||||||
|
$bg = new Imagick("bg.png");
|
||||||
|
$im->compositeImage($bg, imagick::COMPOSITE_OVER, 367, 1);
|
||||||
|
|
||||||
|
// text
|
||||||
|
$stroke = new ImagickDraw();
|
||||||
|
$stroke->setStrokeColor("#504945");
|
||||||
|
$stroke->setFillColor("transparent");
|
||||||
|
$stroke->rectangle(0, 0, 467, 59);
|
||||||
|
$im->drawImage($stroke);
|
||||||
|
|
||||||
|
$draw = new ImagickDraw();
|
||||||
|
$draw->setFillColor("#ebdbb2");
|
||||||
|
$draw->setFontSize(13);
|
||||||
|
$draw->setFont("COMIC.TTF");
|
||||||
|
|
||||||
|
$newstr = "";
|
||||||
|
if(strlen($str) > 84){
|
||||||
|
|
||||||
|
for($i=0; $i<84; $i++){
|
||||||
|
|
||||||
|
$newstr .= $str[$i];
|
||||||
|
}
|
||||||
|
|
||||||
|
$str = trim($newstr) . "...";
|
||||||
|
unset($newstr);
|
||||||
|
}
|
||||||
|
|
||||||
|
$str = trim($str);
|
||||||
|
|
||||||
|
$str = explode("\n", wordwrap($str, 45, "\n", true));
|
||||||
|
|
||||||
|
if(count($str) === 1){
|
||||||
|
|
||||||
|
$im->annotateImage($draw, 5, 25, 0, $str[0]);
|
||||||
|
}else{
|
||||||
|
for($i=0; $i<2; $i++){
|
||||||
|
|
||||||
|
$im->annotateImage($draw, 5, (16 * $i) + 15, 0, $str[$i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// flag
|
||||||
|
if(idate("m") === 11){
|
||||||
|
$path = "flag/xmas/";
|
||||||
|
}else{
|
||||||
|
$path = "flag/";
|
||||||
|
}
|
||||||
|
|
||||||
|
$merge = new Imagick($path . strtolower($res["server"]["country"]["code"]) . ".png");
|
||||||
|
$height = $merge->getImageHeight();
|
||||||
|
|
||||||
|
$im->compositeImage($merge, imagick::COMPOSITE_OVER, 5, 46 - ($height / 2));
|
||||||
|
|
||||||
|
// ip
|
||||||
|
$draw->setFillColor("#bdae93");
|
||||||
|
$im->annotateImage($draw, 30, 51, 0, $res["server"]["domains"][0]);
|
||||||
|
|
||||||
|
// users
|
||||||
|
if($res["server"]["online"] > 0){
|
||||||
|
$name = "buddy.png";
|
||||||
|
}else{
|
||||||
|
$name = "buddy_alone.png";
|
||||||
|
}
|
||||||
|
|
||||||
|
$buddy = new Imagick($name);
|
||||||
|
$im->compositeImage($buddy, imagick::COMPOSITE_OVER, 340, 40);
|
||||||
|
|
||||||
|
$im->annotateImage($draw, 360, 53, 0, $res["server"]["online"] . "/" . $res["server"]["max"]);
|
||||||
|
|
||||||
|
// done.
|
||||||
|
header("Content-Type: image/png");
|
||||||
|
echo $im->getImageBlob();
|
||||||
|
?>
|
After Width: | Height: | Size: 388 B |
After Width: | Height: | Size: 238 B |
After Width: | Height: | Size: 222 B |
After Width: | Height: | Size: 223 B |
After Width: | Height: | Size: 209 B |
After Width: | Height: | Size: 269 B |
After Width: | Height: | Size: 305 B |
After Width: | Height: | Size: 262 B |
After Width: | Height: | Size: 216 B |
After Width: | Height: | Size: 339 B |
After Width: | Height: | Size: 264 B |
After Width: | Height: | Size: 253 B |
After Width: | Height: | Size: 256 B |
After Width: | Height: | Size: 241 B |
After Width: | Height: | Size: 223 B |
After Width: | Height: | Size: 225 B |
After Width: | Height: | Size: 225 B |
After Width: | Height: | Size: 264 B |
After Width: | Height: | Size: 193 B |
After Width: | Height: | Size: 362 B |
After Width: | Height: | Size: 277 B |
After Width: | Height: | Size: 275 B |
After Width: | Height: | Size: 307 B |
After Width: | Height: | Size: 232 B |
After Width: | Height: | Size: 299 B |
After Width: | Height: | Size: 245 B |
After Width: | Height: | Size: 296 B |
After Width: | Height: | Size: 234 B |
After Width: | Height: | Size: 263 B |
After Width: | Height: | Size: 220 B |
After Width: | Height: | Size: 235 B |
After Width: | Height: | Size: 228 B |
After Width: | Height: | Size: 236 B |
After Width: | Height: | Size: 234 B |
After Width: | Height: | Size: 234 B |
After Width: | Height: | Size: 243 B |
After Width: | Height: | Size: 246 B |
After Width: | Height: | Size: 201 B |
After Width: | Height: | Size: 255 B |
After Width: | Height: | Size: 238 B |
After Width: | Height: | Size: 288 B |
After Width: | Height: | Size: 269 B |
After Width: | Height: | Size: 270 B |
After Width: | Height: | Size: 317 B |
After Width: | Height: | Size: 202 B |
After Width: | Height: | Size: 228 B |
After Width: | Height: | Size: 286 B |
After Width: | Height: | Size: 260 B |
After Width: | Height: | Size: 240 B |
After Width: | Height: | Size: 224 B |
After Width: | Height: | Size: 231 B |
After Width: | Height: | Size: 262 B |
After Width: | Height: | Size: 247 B |
After Width: | Height: | Size: 296 B |
After Width: | Height: | Size: 223 B |
After Width: | Height: | Size: 280 B |
After Width: | Height: | Size: 258 B |
After Width: | Height: | Size: 231 B |
After Width: | Height: | Size: 227 B |
After Width: | Height: | Size: 236 B |
After Width: | Height: | Size: 293 B |
After Width: | Height: | Size: 298 B |
After Width: | Height: | Size: 283 B |
After Width: | Height: | Size: 295 B |
After Width: | Height: | Size: 223 B |
After Width: | Height: | Size: 293 B |
After Width: | Height: | Size: 289 B |
After Width: | Height: | Size: 230 B |
After Width: | Height: | Size: 245 B |
After Width: | Height: | Size: 232 B |
After Width: | Height: | Size: 470 B |
After Width: | Height: | Size: 261 B |
After Width: | Height: | Size: 250 B |
After Width: | Height: | Size: 223 B |
After Width: | Height: | Size: 243 B |
After Width: | Height: | Size: 250 B |
After Width: | Height: | Size: 246 B |
After Width: | Height: | Size: 282 B |
After Width: | Height: | Size: 254 B |
After Width: | Height: | Size: 242 B |
After Width: | Height: | Size: 222 B |
After Width: | Height: | Size: 247 B |
After Width: | Height: | Size: 243 B |
After Width: | Height: | Size: 226 B |
After Width: | Height: | Size: 270 B |
After Width: | Height: | Size: 259 B |
After Width: | Height: | Size: 239 B |
After Width: | Height: | Size: 226 B |
After Width: | Height: | Size: 308 B |
After Width: | Height: | Size: 243 B |
After Width: | Height: | Size: 258 B |
After Width: | Height: | Size: 244 B |
After Width: | Height: | Size: 303 B |
After Width: | Height: | Size: 270 B |