├── .gitignore ├── app ├── commands │ ├── .gitkeep │ ├── CleanTableCommand.php │ └── WebsocketServerCommand.php ├── config │ ├── app.php │ ├── auth.php │ ├── cache.php │ ├── compile.php │ ├── database.php │ ├── lowendping.php │ ├── mail.php │ ├── packages │ │ └── .gitkeep │ ├── queue.php │ ├── remote.php │ ├── session.php │ ├── testing │ │ ├── cache.php │ │ └── session.php │ ├── view.php │ └── workbench.php ├── controllers │ ├── .gitkeep │ ├── ApiController.php │ ├── BaseController.php │ └── HomeController.php ├── database │ ├── migrations │ │ ├── .gitkeep │ │ ├── 2014_03_09_112337_create_queries_table.php │ │ ├── 2014_03_09_113619_create_responses_table.php │ │ └── 2014_03_17_031627_crate_ratelimit_table.php │ ├── production.sqlite │ └── seeds │ │ ├── .gitkeep │ │ └── DatabaseSeeder.php ├── filters.php ├── helpers.php ├── jobs │ └── QueryJob.php ├── lang │ └── en │ │ ├── pagination.php │ │ ├── reminders.php │ │ └── validation.php ├── lib │ └── LowEndPing │ │ └── Pusher.php ├── models │ ├── Query.php │ ├── QueryResponse.php │ ├── RateLimit.php │ └── User.php ├── routes.php ├── start │ ├── artisan.php │ ├── global.php │ └── local.php ├── storage │ ├── .gitignore │ ├── cache │ │ └── .gitignore │ ├── logs │ │ └── .gitignore │ ├── meta │ │ └── .gitignore │ ├── sessions │ │ └── .gitignore │ └── views │ │ └── .gitignore ├── tests │ ├── ExampleTest.php │ └── TestCase.php ├── validators.php └── views │ ├── emails │ └── auth │ │ └── reminder.blade.php │ ├── home.blade.php │ ├── layouts │ ├── main.blade.php │ └── navbar.blade.php │ └── result.blade.php ├── artisan ├── bootstrap ├── autoload.php ├── paths.php └── start.php ├── composer.json ├── composer.lock ├── daemon ├── lep.py └── lepconf.py ├── index.php ├── phpunit.xml ├── public ├── .htaccess ├── css │ ├── application.css │ └── bootstrap │ │ ├── bootstrap-theme.css │ │ ├── bootstrap-theme.css.map │ │ ├── bootstrap-theme.min.css │ │ ├── bootstrap.css │ │ ├── bootstrap.css.map │ │ └── bootstrap.min.css ├── favicon.ico ├── fonts │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.svg │ ├── glyphicons-halflings-regular.ttf │ └── glyphicons-halflings-regular.woff ├── index.php ├── js │ ├── application.js │ ├── autobahn.min.js │ └── bootstrap │ │ ├── bootstrap.js │ │ └── bootstrap.min.js ├── packages │ └── .gitkeep └── robots.txt ├── readme.md └── server.php /.gitignore: -------------------------------------------------------------------------------- 1 | /bootstrap/compiled.php 2 | /vendor 3 | composer.phar 4 | .env.local.php 5 | .env.php 6 | .DS_Store 7 | Thumbs.db -------------------------------------------------------------------------------- /app/commands/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nikkiii/lowendping/15321d82459048afa9d7aa85f70ab58baacc02ac/app/commands/.gitkeep -------------------------------------------------------------------------------- /app/commands/CleanTableCommand.php: -------------------------------------------------------------------------------- 1 | subMinutes(30); 42 | 43 | QueryResponse::unsent()->where('created_at', '<', $unsent_min)->delete(); 44 | 45 | // Check the archive 46 | if (Config::get('lowendping.archive.enabled', false)) { 47 | $mintime = \Carbon\Carbon::now()->subDays(Config::get('lowendping.archive.days')); 48 | 49 | $queries = Query::where('created_at', '<', $mintime)->get(); 50 | foreach ($queries as $query) { 51 | $this->info('Deleting query ' . $query->id); 52 | QueryResponse::where('query_id', $query->id)->delete(); 53 | $query->delete(); 54 | } 55 | } 56 | } 57 | 58 | /** 59 | * Get the console command arguments. 60 | * 61 | * @return array 62 | */ 63 | protected function getArguments() 64 | { 65 | return array( 66 | ); 67 | } 68 | 69 | /** 70 | * Get the console command options. 71 | * 72 | * @return array 73 | */ 74 | protected function getOptions() 75 | { 76 | return array( 77 | ); 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /app/commands/WebsocketServerCommand.php: -------------------------------------------------------------------------------- 1 | getSocket(ZMQ::SOCKET_PULL); 46 | 47 | $this->info('Binding ZMQ to ' . $zmq_host); 48 | $pull->bind('tcp://' . $zmq_host); // Binding to 127.0.0.1 means the only client that can connect is itself 49 | $pull->on('message', array($pusher, 'onServerResponse')); 50 | 51 | $this->info('Binding Ratchet Websocket to 0.0.0.0:' . Config::get('lowendping.websocket.port', 8080)); 52 | // Set up our WebSocket server for clients wanting real-time updates 53 | $webSock = new React\Socket\Server($loop); 54 | $webSock->listen(Config::get('lowendping.websocket.port', 8080), '0.0.0.0'); // Binding to 0.0.0.0 means remotes can connect 55 | $webServer = new Ratchet\Server\IoServer( 56 | new Ratchet\Http\HttpServer( 57 | new Ratchet\WebSocket\WsServer( 58 | new Ratchet\Wamp\WampServer( 59 | $pusher 60 | ) 61 | ) 62 | ), 63 | $webSock 64 | ); 65 | 66 | $loop->run(); 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /app/config/app.php: -------------------------------------------------------------------------------- 1 | 'LowEndPing', 15 | 16 | /* 17 | |-------------------------------------------------------------------------- 18 | | Application Credits 19 | |-------------------------------------------------------------------------- 20 | | 21 | | If the above name is changed, then this will add a " - Powered by LowEndPing" to the footer. 22 | | You may disable it, but it doesn't hurt anything and helps the developer. 23 | | 24 | */ 25 | 'credits' => true, 26 | 27 | /* 28 | |-------------------------------------------------------------------------- 29 | | Application Debug Mode 30 | |-------------------------------------------------------------------------- 31 | | 32 | | When your application is in debug mode, detailed error messages with 33 | | stack traces will be shown on every error that occurs within your 34 | | application. If disabled, a simple generic error page is shown. 35 | | 36 | */ 37 | 38 | 'debug' => true, 39 | 40 | /* 41 | |-------------------------------------------------------------------------- 42 | | Application URL 43 | |-------------------------------------------------------------------------- 44 | | 45 | | This URL is used by the console to properly generate URLs when using 46 | | the Artisan command line tool. You should set this to the root of 47 | | your application so that it is used when running Artisan tasks. 48 | | 49 | */ 50 | 51 | 'url' => 'http://localhost', 52 | 53 | /* 54 | |-------------------------------------------------------------------------- 55 | | Application Timezone 56 | |-------------------------------------------------------------------------- 57 | | 58 | | Here you may specify the default timezone for your application, which 59 | | will be used by the PHP date and date-time functions. We have gone 60 | | ahead and set this to a sensible default for you out of the box. 61 | | 62 | */ 63 | 64 | 'timezone' => 'UTC', 65 | 66 | /* 67 | |-------------------------------------------------------------------------- 68 | | Application Locale Configuration 69 | |-------------------------------------------------------------------------- 70 | | 71 | | The application locale determines the default locale that will be used 72 | | by the translation service provider. You are free to set this value 73 | | to any of the locales which will be supported by the application. 74 | | 75 | */ 76 | 77 | 'locale' => 'en', 78 | 79 | /* 80 | |-------------------------------------------------------------------------- 81 | | Encryption Key 82 | |-------------------------------------------------------------------------- 83 | | 84 | | This key is used by the Illuminate encrypter service and should be set 85 | | to a random, 32 character string, otherwise these encrypted strings 86 | | will not be safe. Please do this before deploying an application! 87 | | 88 | */ 89 | 90 | 'key' => 'rRHA92ZjhFzEqfaqJt0qTmudDgm0Y3nL', 91 | 92 | /* 93 | |-------------------------------------------------------------------------- 94 | | Autoloaded Service Providers 95 | |-------------------------------------------------------------------------- 96 | | 97 | | The service providers listed here will be automatically loaded on the 98 | | request to your application. Feel free to add your own services to 99 | | this array to grant expanded functionality to your applications. 100 | | 101 | */ 102 | 103 | 'providers' => array( 104 | 105 | 'Illuminate\Foundation\Providers\ArtisanServiceProvider', 106 | 'Illuminate\Auth\AuthServiceProvider', 107 | 'Illuminate\Cache\CacheServiceProvider', 108 | 'Illuminate\Session\CommandsServiceProvider', 109 | 'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider', 110 | 'Illuminate\Routing\ControllerServiceProvider', 111 | 'Illuminate\Cookie\CookieServiceProvider', 112 | 'Illuminate\Database\DatabaseServiceProvider', 113 | 'Illuminate\Encryption\EncryptionServiceProvider', 114 | 'Illuminate\Filesystem\FilesystemServiceProvider', 115 | 'Illuminate\Hashing\HashServiceProvider', 116 | 'Illuminate\Html\HtmlServiceProvider', 117 | 'Illuminate\Log\LogServiceProvider', 118 | 'Illuminate\Mail\MailServiceProvider', 119 | 'Illuminate\Database\MigrationServiceProvider', 120 | 'Illuminate\Pagination\PaginationServiceProvider', 121 | 'Illuminate\Queue\QueueServiceProvider', 122 | 'Illuminate\Redis\RedisServiceProvider', 123 | 'Illuminate\Remote\RemoteServiceProvider', 124 | 'Illuminate\Auth\Reminders\ReminderServiceProvider', 125 | 'Illuminate\Database\SeedServiceProvider', 126 | 'Illuminate\Session\SessionServiceProvider', 127 | 'Illuminate\Translation\TranslationServiceProvider', 128 | 'Illuminate\Validation\ValidationServiceProvider', 129 | 'Illuminate\View\ViewServiceProvider', 130 | 'Illuminate\Workbench\WorkbenchServiceProvider', 131 | 132 | ), 133 | 134 | /* 135 | |-------------------------------------------------------------------------- 136 | | Service Provider Manifest 137 | |-------------------------------------------------------------------------- 138 | | 139 | | The service provider manifest is used by Laravel to lazy load service 140 | | providers which are not needed for each request, as well to keep a 141 | | list of all of the services. Here, you may set its storage spot. 142 | | 143 | */ 144 | 145 | 'manifest' => storage_path().'/meta', 146 | 147 | /* 148 | |-------------------------------------------------------------------------- 149 | | Class Aliases 150 | |-------------------------------------------------------------------------- 151 | | 152 | | This array of class aliases will be registered when this application 153 | | is started. However, feel free to register as many as you wish as 154 | | the aliases are "lazy" loaded so they don't hinder performance. 155 | | 156 | */ 157 | 158 | 'aliases' => array( 159 | 160 | 'App' => 'Illuminate\Support\Facades\App', 161 | 'Artisan' => 'Illuminate\Support\Facades\Artisan', 162 | 'Auth' => 'Illuminate\Support\Facades\Auth', 163 | 'Blade' => 'Illuminate\Support\Facades\Blade', 164 | 'Cache' => 'Illuminate\Support\Facades\Cache', 165 | 'ClassLoader' => 'Illuminate\Support\ClassLoader', 166 | 'Config' => 'Illuminate\Support\Facades\Config', 167 | 'Controller' => 'Illuminate\Routing\Controller', 168 | 'Cookie' => 'Illuminate\Support\Facades\Cookie', 169 | 'Crypt' => 'Illuminate\Support\Facades\Crypt', 170 | 'DB' => 'Illuminate\Support\Facades\DB', 171 | 'Eloquent' => 'Illuminate\Database\Eloquent\Model', 172 | 'Event' => 'Illuminate\Support\Facades\Event', 173 | 'File' => 'Illuminate\Support\Facades\File', 174 | 'Form' => 'Illuminate\Support\Facades\Form', 175 | 'Hash' => 'Illuminate\Support\Facades\Hash', 176 | 'HTML' => 'Illuminate\Support\Facades\HTML', 177 | 'Input' => 'Illuminate\Support\Facades\Input', 178 | 'Lang' => 'Illuminate\Support\Facades\Lang', 179 | 'Log' => 'Illuminate\Support\Facades\Log', 180 | 'Mail' => 'Illuminate\Support\Facades\Mail', 181 | 'Paginator' => 'Illuminate\Support\Facades\Paginator', 182 | 'Password' => 'Illuminate\Support\Facades\Password', 183 | 'Queue' => 'Illuminate\Support\Facades\Queue', 184 | 'Redirect' => 'Illuminate\Support\Facades\Redirect', 185 | 'Redis' => 'Illuminate\Support\Facades\Redis', 186 | 'Request' => 'Illuminate\Support\Facades\Request', 187 | 'Response' => 'Illuminate\Support\Facades\Response', 188 | 'Route' => 'Illuminate\Support\Facades\Route', 189 | 'Schema' => 'Illuminate\Support\Facades\Schema', 190 | 'Seeder' => 'Illuminate\Database\Seeder', 191 | 'Session' => 'Illuminate\Support\Facades\Session', 192 | 'SSH' => 'Illuminate\Support\Facades\SSH', 193 | 'Str' => 'Illuminate\Support\Str', 194 | 'URL' => 'Illuminate\Support\Facades\URL', 195 | 'Validator' => 'Illuminate\Support\Facades\Validator', 196 | 'View' => 'Illuminate\Support\Facades\View', 197 | 198 | ), 199 | 200 | ); 201 | -------------------------------------------------------------------------------- /app/config/auth.php: -------------------------------------------------------------------------------- 1 | 'eloquent', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Authentication Model 23 | |-------------------------------------------------------------------------- 24 | | 25 | | When using the "Eloquent" authentication driver, we need to know which 26 | | Eloquent model should be used to retrieve your users. Of course, it 27 | | is often just the "User" model but you may use whatever you like. 28 | | 29 | */ 30 | 31 | 'model' => 'User', 32 | 33 | /* 34 | |-------------------------------------------------------------------------- 35 | | Authentication Table 36 | |-------------------------------------------------------------------------- 37 | | 38 | | When using the "Database" authentication driver, we need to know which 39 | | table should be used to retrieve your users. We have chosen a basic 40 | | default value but you may easily change it to any table you like. 41 | | 42 | */ 43 | 44 | 'table' => 'users', 45 | 46 | /* 47 | |-------------------------------------------------------------------------- 48 | | Password Reminder Settings 49 | |-------------------------------------------------------------------------- 50 | | 51 | | Here you may set the settings for password reminders, including a view 52 | | that should be used as your password reminder e-mail. You will also 53 | | be able to set the name of the table that holds the reset tokens. 54 | | 55 | | The "expire" time is the number of minutes that the reminder should be 56 | | considered valid. This security feature keeps tokens short-lived so 57 | | they have less time to be guessed. You may change this as needed. 58 | | 59 | */ 60 | 61 | 'reminder' => array( 62 | 63 | 'email' => 'emails.auth.reminder', 64 | 65 | 'table' => 'password_reminders', 66 | 67 | 'expire' => 60, 68 | 69 | ), 70 | 71 | ); 72 | -------------------------------------------------------------------------------- /app/config/cache.php: -------------------------------------------------------------------------------- 1 | 'file', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | File Cache Location 23 | |-------------------------------------------------------------------------- 24 | | 25 | | When using the "file" cache driver, we need a location where the cache 26 | | files may be stored. A sensible default has been specified, but you 27 | | are free to change it to any other place on disk that you desire. 28 | | 29 | */ 30 | 31 | 'path' => storage_path().'/cache', 32 | 33 | /* 34 | |-------------------------------------------------------------------------- 35 | | Database Cache Connection 36 | |-------------------------------------------------------------------------- 37 | | 38 | | When using the "database" cache driver you may specify the connection 39 | | that should be used to store the cached items. When this option is 40 | | null the default database connection will be utilized for cache. 41 | | 42 | */ 43 | 44 | 'connection' => null, 45 | 46 | /* 47 | |-------------------------------------------------------------------------- 48 | | Database Cache Table 49 | |-------------------------------------------------------------------------- 50 | | 51 | | When using the "database" cache driver we need to know the table that 52 | | should be used to store the cached items. A default table name has 53 | | been provided but you're free to change it however you deem fit. 54 | | 55 | */ 56 | 57 | 'table' => 'cache', 58 | 59 | /* 60 | |-------------------------------------------------------------------------- 61 | | Memcached Servers 62 | |-------------------------------------------------------------------------- 63 | | 64 | | Now you may specify an array of your Memcached servers that should be 65 | | used when utilizing the Memcached cache driver. All of the servers 66 | | should contain a value for "host", "port", and "weight" options. 67 | | 68 | */ 69 | 70 | 'memcached' => array( 71 | 72 | array('host' => '127.0.0.1', 'port' => 11211, 'weight' => 100), 73 | 74 | ), 75 | 76 | /* 77 | |-------------------------------------------------------------------------- 78 | | Cache Key Prefix 79 | |-------------------------------------------------------------------------- 80 | | 81 | | When utilizing a RAM based store such as APC or Memcached, there might 82 | | be other applications utilizing the same cache. So, we'll specify a 83 | | value to get prefixed to all our keys so we can avoid collisions. 84 | | 85 | */ 86 | 87 | 'prefix' => 'laravel', 88 | 89 | ); 90 | -------------------------------------------------------------------------------- /app/config/compile.php: -------------------------------------------------------------------------------- 1 | PDO::FETCH_CLASS, 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Default Database Connection Name 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may specify which of the database connections below you wish 24 | | to use as your default connection for all database work. Of course 25 | | you may use many connections at once using the Database library. 26 | | 27 | */ 28 | 29 | 'default' => 'sqlite', 30 | 31 | /* 32 | |-------------------------------------------------------------------------- 33 | | Database Connections 34 | |-------------------------------------------------------------------------- 35 | | 36 | | Here are each of the database connections setup for your application. 37 | | Of course, examples of configuring each database platform that is 38 | | supported by Laravel is shown below to make development simple. 39 | | 40 | | 41 | | All database work in Laravel is done through the PHP PDO facilities 42 | | so make sure you have the driver for your particular database of 43 | | choice installed on your machine before you begin development. 44 | | 45 | */ 46 | 47 | 'connections' => array( 48 | 49 | 'sqlite' => array( 50 | 'driver' => 'sqlite', 51 | 'database' => __DIR__.'/../database/production.sqlite', 52 | 'prefix' => '', 53 | ), 54 | 55 | 'mysql' => array( 56 | 'driver' => 'mysql', 57 | 'host' => 'localhost', 58 | 'database' => 'database', 59 | 'username' => 'root', 60 | 'password' => '', 61 | 'charset' => 'utf8', 62 | 'collation' => 'utf8_unicode_ci', 63 | 'prefix' => '', 64 | ), 65 | 66 | 'pgsql' => array( 67 | 'driver' => 'pgsql', 68 | 'host' => 'localhost', 69 | 'database' => 'database', 70 | 'username' => 'root', 71 | 'password' => '', 72 | 'charset' => 'utf8', 73 | 'prefix' => '', 74 | 'schema' => 'public', 75 | ), 76 | 77 | 'sqlsrv' => array( 78 | 'driver' => 'sqlsrv', 79 | 'host' => 'localhost', 80 | 'database' => 'database', 81 | 'username' => 'root', 82 | 'password' => '', 83 | 'prefix' => '', 84 | ), 85 | 86 | ), 87 | 88 | /* 89 | |-------------------------------------------------------------------------- 90 | | Migration Repository Table 91 | |-------------------------------------------------------------------------- 92 | | 93 | | This table keeps track of all the migrations that have already run for 94 | | your application. Using this information, we can determine which of 95 | | the migrations on disk haven't actually been run in the database. 96 | | 97 | */ 98 | 99 | 'migrations' => 'migrations', 100 | 101 | /* 102 | |-------------------------------------------------------------------------- 103 | | Redis Databases 104 | |-------------------------------------------------------------------------- 105 | | 106 | | Redis is an open source, fast, and advanced key-value store that also 107 | | provides a richer set of commands than a typical key-value systems 108 | | such as APC or Memcached. Laravel makes it easy to dig right in. 109 | | 110 | */ 111 | 112 | 'redis' => array( 113 | 114 | 'cluster' => false, 115 | 116 | 'default' => array( 117 | 'host' => '127.0.0.1', 118 | 'port' => 6379, 119 | 'database' => 0, 120 | ), 121 | 122 | ), 123 | 124 | ); 125 | -------------------------------------------------------------------------------- /app/config/lowendping.php: -------------------------------------------------------------------------------- 1 | array( 14 | 1 => array('name' => 'Example', 'host' => 'localhost', 'port' => 12337, 'auth' => 'SOME_SECURE_STRING') 15 | ), 16 | 17 | /* 18 | |-------------------------------------------------------------------------- 19 | | API 20 | |-------------------------------------------------------------------------- 21 | | 22 | | There is an 'api' which allows a list of servers to be served using json. 23 | | It is mainly used for programs which wish to interact with LowEndPing instances, 24 | | and does not provide any extra information. 25 | | 26 | */ 27 | 'api' => array( 28 | 'enabled' => false 29 | ), 30 | 31 | /* 32 | |-------------------------------------------------------------------------- 33 | | Result Archive 34 | |-------------------------------------------------------------------------- 35 | | 36 | | You can archive LowEndPing results (keep them in the query response table) for a set amount of time. 37 | | This allows results to be shared and viewed by others. 38 | | Set 'enabled' to false to disable this and delete responses as soon as they are seen by the client. 39 | | 40 | */ 41 | 'archive' => array( 42 | 'enabled' => true, 43 | 'days' => 7 44 | ), 45 | 46 | /* 47 | |-------------------------------------------------------------------------- 48 | | Query settings 49 | |-------------------------------------------------------------------------- 50 | | 51 | | This is the timeout used when connecting to the LowEndPing servers, 5 is usually a good value to use. 52 | | 53 | */ 54 | 'query' => array( 55 | 'timeout' => 5 56 | ), 57 | 58 | /* 59 | |-------------------------------------------------------------------------- 60 | | Rate limiting 61 | |-------------------------------------------------------------------------- 62 | | 63 | | Rate limit IP addresses so they cannot spam queries. 64 | | Set 'queries' to 0 or false to disable 65 | | 66 | */ 67 | 'ratelimit' => array( 68 | 'queries' => 60, 69 | 'timespan' => 1440 70 | ), 71 | 72 | 73 | /* 74 | |-------------------------------------------------------------------------- 75 | | Enabled query types 76 | |-------------------------------------------------------------------------- 77 | | 78 | | Disable available query types by commenting out lines. By default, everything is enabled. 79 | | 80 | */ 81 | 'querytypes' => array( 82 | 'ping' => 'ping', 83 | 'ping6' => 'ping6', 84 | 'trace' => 'traceroute', 85 | 'trace6' => 'traceroute6', 86 | 'mtr' => 'mtr', 87 | 'mtr6' => 'mtr6' 88 | ), 89 | 90 | 91 | /* 92 | |-------------------------------------------------------------------------- 93 | | Websocket support 94 | |-------------------------------------------------------------------------- 95 | | 96 | | Websocket support via Ratchet and ZMQ 97 | | 98 | */ 99 | 'websocket' => array( 100 | 'enabled' => true, 101 | 'port' => 8080, 102 | 103 | // Websocket is proxied through webserver 104 | 'proxied' => false, 105 | 106 | // ZeroMQ Configuration 107 | 'zeromq' => array( 108 | 'host' => '127.0.0.1', 109 | 'port' => 5555 110 | ) 111 | ), 112 | ); 113 | -------------------------------------------------------------------------------- /app/config/mail.php: -------------------------------------------------------------------------------- 1 | 'smtp', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | SMTP Host Address 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may provide the host address of the SMTP server used by your 26 | | applications. A default option is provided that is compatible with 27 | | the Postmark mail service, which will provide reliable delivery. 28 | | 29 | */ 30 | 31 | 'host' => 'smtp.mailgun.org', 32 | 33 | /* 34 | |-------------------------------------------------------------------------- 35 | | SMTP Host Port 36 | |-------------------------------------------------------------------------- 37 | | 38 | | This is the SMTP port used by your application to delivery e-mails to 39 | | users of your application. Like the host we have set this value to 40 | | stay compatible with the Postmark e-mail application by default. 41 | | 42 | */ 43 | 44 | 'port' => 587, 45 | 46 | /* 47 | |-------------------------------------------------------------------------- 48 | | Global "From" Address 49 | |-------------------------------------------------------------------------- 50 | | 51 | | You may wish for all e-mails sent by your application to be sent from 52 | | the same address. Here, you may specify a name and address that is 53 | | used globally for all e-mails that are sent by your application. 54 | | 55 | */ 56 | 57 | 'from' => array('address' => null, 'name' => null), 58 | 59 | /* 60 | |-------------------------------------------------------------------------- 61 | | E-Mail Encryption Protocol 62 | |-------------------------------------------------------------------------- 63 | | 64 | | Here you may specify the encryption protocol that should be used when 65 | | the application send e-mail messages. A sensible default using the 66 | | transport layer security protocol should provide great security. 67 | | 68 | */ 69 | 70 | 'encryption' => 'tls', 71 | 72 | /* 73 | |-------------------------------------------------------------------------- 74 | | SMTP Server Username 75 | |-------------------------------------------------------------------------- 76 | | 77 | | If your SMTP server requires a username for authentication, you should 78 | | set it here. This will get used to authenticate with your server on 79 | | connection. You may also set the "password" value below this one. 80 | | 81 | */ 82 | 83 | 'username' => null, 84 | 85 | /* 86 | |-------------------------------------------------------------------------- 87 | | SMTP Server Password 88 | |-------------------------------------------------------------------------- 89 | | 90 | | Here you may set the password required by your SMTP server to send out 91 | | messages from your application. This will be given to the server on 92 | | connection so that the application will be able to send messages. 93 | | 94 | */ 95 | 96 | 'password' => null, 97 | 98 | /* 99 | |-------------------------------------------------------------------------- 100 | | Sendmail System Path 101 | |-------------------------------------------------------------------------- 102 | | 103 | | When using the "sendmail" driver to send e-mails, we will need to know 104 | | the path to where Sendmail lives on this server. A default path has 105 | | been provided here, which will work well on most of your systems. 106 | | 107 | */ 108 | 109 | 'sendmail' => '/usr/sbin/sendmail -bs', 110 | 111 | /* 112 | |-------------------------------------------------------------------------- 113 | | Mail "Pretend" 114 | |-------------------------------------------------------------------------- 115 | | 116 | | When this option is enabled, e-mail will not actually be sent over the 117 | | web and will instead be written to your application's logs files so 118 | | you may inspect the message. This is great for local development. 119 | | 120 | */ 121 | 122 | 'pretend' => false, 123 | 124 | ); -------------------------------------------------------------------------------- /app/config/packages/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nikkiii/lowendping/15321d82459048afa9d7aa85f70ab58baacc02ac/app/config/packages/.gitkeep -------------------------------------------------------------------------------- /app/config/queue.php: -------------------------------------------------------------------------------- 1 | 'sync', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Queue Connections 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may configure the connection information for each server that 26 | | is used by your application. A default configuration has been added 27 | | for each back-end shipped with Laravel. You are free to add more. 28 | | 29 | */ 30 | 31 | 'connections' => array( 32 | 33 | 'sync' => array( 34 | 'driver' => 'sync', 35 | ), 36 | 37 | 'beanstalkd' => array( 38 | 'driver' => 'beanstalkd', 39 | 'host' => 'localhost', 40 | 'queue' => 'default', 41 | ), 42 | 43 | 'sqs' => array( 44 | 'driver' => 'sqs', 45 | 'key' => 'your-public-key', 46 | 'secret' => 'your-secret-key', 47 | 'queue' => 'your-queue-url', 48 | 'region' => 'us-east-1', 49 | ), 50 | 51 | 'iron' => array( 52 | 'driver' => 'iron', 53 | 'project' => 'your-project-id', 54 | 'token' => 'your-token', 55 | 'queue' => 'your-queue-name', 56 | ), 57 | 58 | 'redis' => array( 59 | 'driver' => 'redis', 60 | 'queue' => 'default', 61 | ), 62 | 63 | ), 64 | 65 | /* 66 | |-------------------------------------------------------------------------- 67 | | Failed Queue Jobs 68 | |-------------------------------------------------------------------------- 69 | | 70 | | These options configure the behavior of failed queue job logging so you 71 | | can control which database and table are used to store the jobs that 72 | | have failed. You may change them to any database / table you wish. 73 | | 74 | */ 75 | 76 | 'failed' => array( 77 | 78 | 'database' => 'mysql', 'table' => 'failed_jobs', 79 | 80 | ), 81 | 82 | ); 83 | -------------------------------------------------------------------------------- /app/config/remote.php: -------------------------------------------------------------------------------- 1 | 'production', 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Remote Server Connections 21 | |-------------------------------------------------------------------------- 22 | | 23 | | These are the servers that will be accessible via the SSH task runner 24 | | facilities of Laravel. This feature radically simplifies executing 25 | | tasks on your servers, such as deploying out these applications. 26 | | 27 | */ 28 | 29 | 'connections' => array( 30 | 31 | 'production' => array( 32 | 'host' => '', 33 | 'username' => '', 34 | 'password' => '', 35 | 'key' => '', 36 | 'keyphrase' => '', 37 | 'root' => '/var/www', 38 | ), 39 | 40 | ), 41 | 42 | /* 43 | |-------------------------------------------------------------------------- 44 | | Remote Server Groups 45 | |-------------------------------------------------------------------------- 46 | | 47 | | Here you may list connections under a single group name, which allows 48 | | you to easily access all of the servers at once using a short name 49 | | that is extremely easy to remember, such as "web" or "database". 50 | | 51 | */ 52 | 53 | 'groups' => array( 54 | 55 | 'web' => array('production') 56 | 57 | ), 58 | 59 | ); -------------------------------------------------------------------------------- /app/config/session.php: -------------------------------------------------------------------------------- 1 | 'file', 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | Session Lifetime 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Here you may specify the number of minutes that you wish the session 27 | | to be allowed to remain idle before it expires. If you want them 28 | | to immediately expire on the browser closing, set that option. 29 | | 30 | */ 31 | 32 | 'lifetime' => 120, 33 | 34 | 'expire_on_close' => false, 35 | 36 | /* 37 | |-------------------------------------------------------------------------- 38 | | Session File Location 39 | |-------------------------------------------------------------------------- 40 | | 41 | | When using the native session driver, we need a location where session 42 | | files may be stored. A default has been set for you but a different 43 | | location may be specified. This is only needed for file sessions. 44 | | 45 | */ 46 | 47 | 'files' => storage_path().'/sessions', 48 | 49 | /* 50 | |-------------------------------------------------------------------------- 51 | | Session Database Connection 52 | |-------------------------------------------------------------------------- 53 | | 54 | | When using the "database" or "redis" session drivers, you may specify a 55 | | connection that should be used to manage these sessions. This should 56 | | correspond to a connection in your database configuration options. 57 | | 58 | */ 59 | 60 | 'connection' => null, 61 | 62 | /* 63 | |-------------------------------------------------------------------------- 64 | | Session Database Table 65 | |-------------------------------------------------------------------------- 66 | | 67 | | When using the "database" session driver, you may specify the table we 68 | | should use to manage the sessions. Of course, a sensible default is 69 | | provided for you; however, you are free to change this as needed. 70 | | 71 | */ 72 | 73 | 'table' => 'sessions', 74 | 75 | /* 76 | |-------------------------------------------------------------------------- 77 | | Session Sweeping Lottery 78 | |-------------------------------------------------------------------------- 79 | | 80 | | Some session drivers must manually sweep their storage location to get 81 | | rid of old sessions from storage. Here are the chances that it will 82 | | happen on a given request. By default, the odds are 2 out of 100. 83 | | 84 | */ 85 | 86 | 'lottery' => array(2, 100), 87 | 88 | /* 89 | |-------------------------------------------------------------------------- 90 | | Session Cookie Name 91 | |-------------------------------------------------------------------------- 92 | | 93 | | Here you may change the name of the cookie used to identify a session 94 | | instance by ID. The name specified here will get used every time a 95 | | new session cookie is created by the framework for every driver. 96 | | 97 | */ 98 | 99 | 'cookie' => 'laravel_session', 100 | 101 | /* 102 | |-------------------------------------------------------------------------- 103 | | Session Cookie Path 104 | |-------------------------------------------------------------------------- 105 | | 106 | | The session cookie path determines the path for which the cookie will 107 | | be regarded as available. Typically, this will be the root path of 108 | | your application but you are free to change this when necessary. 109 | | 110 | */ 111 | 112 | 'path' => '/', 113 | 114 | /* 115 | |-------------------------------------------------------------------------- 116 | | Session Cookie Domain 117 | |-------------------------------------------------------------------------- 118 | | 119 | | Here you may change the domain of the cookie used to identify a session 120 | | in your application. This will determine which domains the cookie is 121 | | available to in your application. A sensible default has been set. 122 | | 123 | */ 124 | 125 | 'domain' => null, 126 | 127 | /* 128 | |-------------------------------------------------------------------------- 129 | | HTTPS Only Cookies 130 | |-------------------------------------------------------------------------- 131 | | 132 | | By setting this option to true, session cookies will only be sent back 133 | | to the server if the browser has a HTTPS connection. This will keep 134 | | the cookie from being sent to you if it can not be done securely. 135 | | 136 | */ 137 | 138 | 'secure' => false, 139 | 140 | ); 141 | -------------------------------------------------------------------------------- /app/config/testing/cache.php: -------------------------------------------------------------------------------- 1 | 'array', 19 | 20 | ); -------------------------------------------------------------------------------- /app/config/testing/session.php: -------------------------------------------------------------------------------- 1 | 'array', 20 | 21 | ); -------------------------------------------------------------------------------- /app/config/view.php: -------------------------------------------------------------------------------- 1 | array(__DIR__.'/../views'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Pagination View 21 | |-------------------------------------------------------------------------- 22 | | 23 | | This view will be used to render the pagination link output, and can 24 | | be easily customized here to show any view you like. A clean view 25 | | compatible with Twitter's Bootstrap is given to you by default. 26 | | 27 | */ 28 | 29 | 'pagination' => 'pagination::slider-3', 30 | 31 | ); 32 | -------------------------------------------------------------------------------- /app/config/workbench.php: -------------------------------------------------------------------------------- 1 | '', 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Workbench Author E-Mail Address 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Like the option above, your e-mail address is used when generating new 24 | | workbench packages. The e-mail is placed in your composer.json file 25 | | automatically after the package is created by the workbench tool. 26 | | 27 | */ 28 | 29 | 'email' => '', 30 | 31 | ); -------------------------------------------------------------------------------- /app/controllers/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nikkiii/lowendping/15321d82459048afa9d7aa85f70ab58baacc02ac/app/controllers/.gitkeep -------------------------------------------------------------------------------- /app/controllers/ApiController.php: -------------------------------------------------------------------------------- 1 | beforeFilter(function() { 7 | if (!Config::get('lowendping.api.enabled', false)) { 8 | return Response::make('API Disabled', 403); 9 | } 10 | }); 11 | } 12 | 13 | public function serverList() { 14 | $list = array(); 15 | 16 | foreach (Config::get('lowendping.servers') as $server => $info) { 17 | $list[$server] = $info['name']; 18 | } 19 | 20 | return Response::json($list); 21 | } 22 | 23 | } -------------------------------------------------------------------------------- /app/controllers/BaseController.php: -------------------------------------------------------------------------------- 1 | layout)) 13 | { 14 | $this->layout = View::make($this->layout); 15 | } 16 | } 17 | 18 | } -------------------------------------------------------------------------------- /app/controllers/HomeController.php: -------------------------------------------------------------------------------- 1 | with('servers', Config::get('lowendping.servers')); 20 | } 21 | 22 | public function showResult(Query $query) { 23 | $servers = Config::get('lowendping.servers'); 24 | $responses = array(); 25 | 26 | foreach ($query->responses()->orderBy('server_id', 'asc')->get() as $response) { 27 | $response->server = $servers[$response->server_id]; 28 | $responses[] = $response; 29 | } 30 | 31 | $query->expire_at = $query->created_at->addDays(Config::get('lowendping.archive.days', 7)); 32 | 33 | return View::make('result')->with('query', $query)->with('responses', $responses); 34 | } 35 | 36 | public function submitQuery() { 37 | $validator = Validator::make(Input::all(), 38 | array( 39 | 'query' => array('required', 'query'), 40 | 'servers' => array('required', 'array'), 41 | 'type' => array('required', 'type') 42 | ) 43 | ); 44 | 45 | if ($validator->fails()) { 46 | return Response::json(array('success' => false, 'error' => $validator->messages()->first())); 47 | } 48 | 49 | // Validate rate limit 50 | $ip = Request::getClientIp(); 51 | 52 | $querylimit = Config::get('lowendping.ratelimit.queries'); 53 | 54 | if (!empty($querylimit)) { 55 | $limit = RateLimit::find($ip); 56 | 57 | if ($limit) { 58 | $time = time(); 59 | 60 | $expiration = (int) ($limit->time + Config::get('lowendping.ratelimit.timespan')); 61 | 62 | if ($expiration > $time) { 63 | if ($limit->hits >= $querylimit) { 64 | $reset = ($expiration - $time) / 60; 65 | if ($reset <= 1) { 66 | return Response::json(array('success' => false, 'error' => 'Rate limit exceeded, please try again in 1 minute.')); 67 | } 68 | return Response::json(array('success' => false, 'error' => 'Rate limit exceeded, please try again in ' . $reset . ' minutes.')); 69 | } 70 | 71 | $limit->hits++; 72 | $limit->save(); 73 | } else { 74 | $limit->time = time(); 75 | $limit->hits = 1; 76 | $limit->save(); 77 | } 78 | } else { 79 | $limit = new RateLimit; 80 | $limit->ip = $ip; 81 | $limit->hits = 1; 82 | $limit->time = time(); 83 | $limit->save(); 84 | } 85 | } 86 | 87 | $servers = Config::get('lowendping.servers'); 88 | 89 | $serverIds = array(); 90 | 91 | // Validate servers 92 | foreach (Input::get('servers') as $id => $val) { 93 | if (!isset($servers[$id])) { 94 | return Response::json(array('success' => false, 'error' => 'Invalid server ' . $id)); 95 | } 96 | $serverIds[] = $id; 97 | } 98 | 99 | // Process the query 100 | $query = Input::get('query'); 101 | 102 | $q = new Query; 103 | $q->query = $query; 104 | $q->servers = serialize($serverIds); 105 | $q->save(); 106 | 107 | Queue::push('QueryJob', array('id' => $q->id, 'query' => $query, 'type' => Input::get('type'), 'servers' => $serverIds)); 108 | 109 | $response = array( 110 | 'success' => true, 111 | 'queryid' => $q->id, 112 | 'serverCount' => count($serverIds) 113 | ); 114 | 115 | if (Config::get('lowendping.websocket.enabled', false)) { 116 | $response['websocket'] = websocket_url(Config::get('lowendping.websocket.path', ''), Config::get('lowendping.websocket.proxied', false) ? false : Config::get('lowendping.websocket.port', 8080)); 117 | } 118 | 119 | if (Config::get('lowendping.archive.enabled', false)) { 120 | $response['resultLink'] = action('HomeController@showResult', array('query' => $q->id)); 121 | } 122 | 123 | return Response::json($response); 124 | } 125 | 126 | private function checkQueryType($query, $type = 4) { 127 | if ($type == 4 && filter_var($query, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE)) { 128 | return true; 129 | } else if ($type == 6 && filter_var($query, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { 130 | return true; 131 | } 132 | return false; 133 | } 134 | 135 | public function checkResponses(Query $query) { 136 | $out = array(); 137 | 138 | $archive = Config::get('lowendping.archive.enabled', false); 139 | 140 | foreach ($query->responses()->unsent()->get() as $response) { 141 | if ($archive) { 142 | $response->sent = 1; 143 | $response->save(); 144 | } else { 145 | $response->delete(); 146 | } 147 | 148 | $out[] = array('id' => $response->server_id, 'data' => $response->response); 149 | } 150 | 151 | return Response::json($out); 152 | } 153 | 154 | public function serverResponse() { 155 | $validator = Validator::make(Input::all(), 156 | array( 157 | 'id' => array('required', 'exists:queries,id'), 158 | 'serverid' => array('required', 'server'), 159 | 'response' => array('required'), 160 | 'auth' => array('required') 161 | ) 162 | ); 163 | 164 | if ($validator->fails()) { 165 | return Response::json(array('success' => false, 'error' => $validator->messages()->first())); 166 | } 167 | 168 | $query = Query::find(Input::get('id')); 169 | 170 | $serverid = Input::get('serverid'); 171 | 172 | $servers = Config::get('lowendping.servers'); 173 | 174 | if (QueryResponse::where('server_id', $serverid)->where('query_id', $query->id)->count() > 0) { 175 | return Response::json(array('success' => false, 'error' => 'Response already logged!')); 176 | } 177 | 178 | if (!Input::has('auth') || Input::get('auth') != $servers[$serverid]['auth']) { 179 | // Should we be doing this? It makes sense since it could be a valid error. 180 | $this->submitResponse($query, $serverid, 'Invalid response authentication.'); 181 | return Response::json(array('success' => false, 'error' => 'Invalid authentication!')); 182 | } 183 | 184 | $this->submitResponse($query, $serverid, Input::get('response')); 185 | } 186 | 187 | private function submitResponse($query, $server_id, $res) { 188 | $response = new QueryResponse; 189 | $response->server_id = $server_id; 190 | $response->response = $res; 191 | $query->responses()->save($response); 192 | 193 | if (Config::get('lowendping.websocket.enabled')) { 194 | // Use ZeroMQ to send the data 195 | $context = new ZMQContext(); 196 | $socket = $context->getSocket(ZMQ::SOCKET_PUSH, 'Response Pusher'); 197 | $socket->connect("tcp://localhost:5555"); 198 | 199 | $entryData = array('query_id' => $query->id, 'server_id' => $server_id, 'data' => $res); 200 | 201 | $socket->send(json_encode($entryData)); 202 | } 203 | } 204 | 205 | } -------------------------------------------------------------------------------- /app/database/migrations/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nikkiii/lowendping/15321d82459048afa9d7aa85f70ab58baacc02ac/app/database/migrations/.gitkeep -------------------------------------------------------------------------------- /app/database/migrations/2014_03_09_112337_create_queries_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 17 | $table->string('query', 512); 18 | $table->string('servers', 512); // This is actually a comma separated list 19 | $table->timestamps(); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | * 26 | * @return void 27 | */ 28 | public function down() 29 | { 30 | Schema::drop('queries'); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /app/database/migrations/2014_03_09_113619_create_responses_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 17 | $table->integer('query_id'); 18 | $table->integer('server_id'); 19 | $table->boolean('sent')->default(0); 20 | $table->text('response')->nullable(); 21 | $table->timestamps(); 22 | }); 23 | } 24 | 25 | /** 26 | * Reverse the migrations. 27 | * 28 | * @return void 29 | */ 30 | public function down() 31 | { 32 | Schema::drop('responses'); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /app/database/migrations/2014_03_17_031627_crate_ratelimit_table.php: -------------------------------------------------------------------------------- 1 | string('ip', 64); 17 | $table->integer('hits')->default(0); 18 | $table->integer('time'); 19 | 20 | $table->unique('ip'); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | * 27 | * @return void 28 | */ 29 | public function down() 30 | { 31 | Schema::drop('ratelimit'); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /app/database/production.sqlite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nikkiii/lowendping/15321d82459048afa9d7aa85f70ab58baacc02ac/app/database/production.sqlite -------------------------------------------------------------------------------- /app/database/seeds/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nikkiii/lowendping/15321d82459048afa9d7aa85f70ab58baacc02ac/app/database/seeds/.gitkeep -------------------------------------------------------------------------------- /app/database/seeds/DatabaseSeeder.php: -------------------------------------------------------------------------------- 1 | call('UserTableSeeder'); 15 | } 16 | 17 | } -------------------------------------------------------------------------------- /app/filters.php: -------------------------------------------------------------------------------- 1 | queryServer($id, $servers[$id], $data); 10 | } 11 | 12 | $job->delete(); 13 | } 14 | 15 | private function queryServer($id, $server, $data) { 16 | // Add required fields 17 | $data['serverid'] = $id; 18 | $data['auth'] = $server['auth']; 19 | // Connect and send the data 20 | $fs = @fsockopen($server['host'], $server['port'], $errno, $errstr, Config::get('lowendping.query.timeout', 5)); 21 | if (!$fs) { 22 | // mark as unable to connect so we aren't waiting forever 23 | $resp = new QueryResponse; 24 | $resp->query_id = $data['id']; 25 | $resp->server_id = $id; 26 | $resp->response = 'Failed to connect.'; 27 | $resp->save(); 28 | return; 29 | } 30 | fwrite($fs, json_encode($data)); 31 | fclose($fs); 32 | } 33 | 34 | } -------------------------------------------------------------------------------- /app/lang/en/pagination.php: -------------------------------------------------------------------------------- 1 | '« Previous', 17 | 18 | 'next' => 'Next »', 19 | 20 | ); -------------------------------------------------------------------------------- /app/lang/en/reminders.php: -------------------------------------------------------------------------------- 1 | "Passwords must be at least six characters and match the confirmation.", 17 | 18 | "user" => "We can't find a user with that e-mail address.", 19 | 20 | "token" => "This password reset token is invalid.", 21 | 22 | "sent" => "Password reminder sent!", 23 | 24 | ); 25 | -------------------------------------------------------------------------------- /app/lang/en/validation.php: -------------------------------------------------------------------------------- 1 | "The :attribute must be accepted.", 17 | "active_url" => "The :attribute is not a valid URL.", 18 | "after" => "The :attribute must be a date after :date.", 19 | "alpha" => "The :attribute may only contain letters.", 20 | "alpha_dash" => "The :attribute may only contain letters, numbers, and dashes.", 21 | "alpha_num" => "The :attribute may only contain letters and numbers.", 22 | "array" => "The :attribute must be an array.", 23 | "before" => "The :attribute must be a date before :date.", 24 | "between" => array( 25 | "numeric" => "The :attribute must be between :min and :max.", 26 | "file" => "The :attribute must be between :min and :max kilobytes.", 27 | "string" => "The :attribute must be between :min and :max characters.", 28 | "array" => "The :attribute must have between :min and :max items.", 29 | ), 30 | "confirmed" => "The :attribute confirmation does not match.", 31 | "date" => "The :attribute is not a valid date.", 32 | "date_format" => "The :attribute does not match the format :format.", 33 | "different" => "The :attribute and :other must be different.", 34 | "digits" => "The :attribute must be :digits digits.", 35 | "digits_between" => "The :attribute must be between :min and :max digits.", 36 | "email" => "The :attribute format is invalid.", 37 | "exists" => "The selected :attribute is invalid.", 38 | "image" => "The :attribute must be an image.", 39 | "in" => "The selected :attribute is invalid.", 40 | "integer" => "The :attribute must be an integer.", 41 | "ip" => "The :attribute must be a valid IP address.", 42 | "max" => array( 43 | "numeric" => "The :attribute may not be greater than :max.", 44 | "file" => "The :attribute may not be greater than :max kilobytes.", 45 | "string" => "The :attribute may not be greater than :max characters.", 46 | "array" => "The :attribute may not have more than :max items.", 47 | ), 48 | "mimes" => "The :attribute must be a file of type: :values.", 49 | "min" => array( 50 | "numeric" => "The :attribute must be at least :min.", 51 | "file" => "The :attribute must be at least :min kilobytes.", 52 | "string" => "The :attribute must be at least :min characters.", 53 | "array" => "The :attribute must have at least :min items.", 54 | ), 55 | "not_in" => "The selected :attribute is invalid.", 56 | "numeric" => "The :attribute must be a number.", 57 | "regex" => "The :attribute format is invalid.", 58 | "required" => "The :attribute field is required.", 59 | "required_if" => "The :attribute field is required when :other is :value.", 60 | "required_with" => "The :attribute field is required when :values is present.", 61 | "required_without" => "The :attribute field is required when :values is not present.", 62 | "same" => "The :attribute and :other must match.", 63 | "size" => array( 64 | "numeric" => "The :attribute must be :size.", 65 | "file" => "The :attribute must be :size kilobytes.", 66 | "string" => "The :attribute must be :size characters.", 67 | "array" => "The :attribute must contain :size items.", 68 | ), 69 | "unique" => "The :attribute has already been taken.", 70 | "url" => "The :attribute format is invalid.", 71 | 72 | 73 | "query" => "The :attribute is invalid.", 74 | "server" => "The :attribute is invalid.", 75 | "type" => "The :attribute is invalid.", 76 | 77 | /* 78 | |-------------------------------------------------------------------------- 79 | | Custom Validation Language Lines 80 | |-------------------------------------------------------------------------- 81 | | 82 | | Here you may specify custom validation messages for attributes using the 83 | | convention "attribute.rule" to name the lines. This makes it quick to 84 | | specify a specific custom language line for a given attribute rule. 85 | | 86 | */ 87 | 88 | 'custom' => array(), 89 | 90 | /* 91 | |-------------------------------------------------------------------------- 92 | | Custom Validation Attributes 93 | |-------------------------------------------------------------------------- 94 | | 95 | | The following language lines are used to swap attribute place-holders 96 | | with something more reader friendly such as E-Mail Address instead 97 | | of "email". This simply helps us make messages a little cleaner. 98 | | 99 | */ 100 | 101 | 'attributes' => array(), 102 | 103 | ); 104 | -------------------------------------------------------------------------------- /app/lib/LowEndPing/Pusher.php: -------------------------------------------------------------------------------- 1 | getId(), $this->subscribedTopics)) { 14 | $this->subscribedTopics[$topic->getId()] = $topic; 15 | } 16 | } 17 | 18 | public function onUnSubscribe(ConnectionInterface $conn, $topic) { 19 | if (array_key_exists($topic->getId(), $this->subscribedTopics)) { 20 | unset($this->subscribedTopics[$topic->getId()]); 21 | } 22 | } 23 | 24 | public function onOpen(ConnectionInterface $conn) { 25 | } 26 | 27 | public function onClose(ConnectionInterface $conn) { 28 | } 29 | 30 | public function onCall(ConnectionInterface $conn, $id, $topic, array $params) { 31 | // In this application if clients send data it's because the user hacked around in console 32 | $conn->callError($id, $topic, 'You are not allowed to make calls')->close(); 33 | } 34 | 35 | public function onPublish(ConnectionInterface $conn, $topic, $event, array $exclude, array $eligible) { 36 | // In this application if clients send data it's because the user hacked around in console 37 | $conn->close(); 38 | } 39 | 40 | public function onError(ConnectionInterface $conn, \Exception $e) { 41 | } 42 | 43 | /** 44 | * @param string JSON'ified string we'll receive from ZeroMQ 45 | */ 46 | public function onServerResponse($entry) { 47 | $entryData = json_decode($entry, true); 48 | 49 | // If the lookup topic object isn't set there is no one to publish to 50 | if (!array_key_exists($entryData['query_id'], $this->subscribedTopics)) { 51 | return; 52 | } 53 | 54 | $response = \QueryResponse::where('query_id', $entryData['query_id'])->where('server_id', $entryData['server_id']); 55 | 56 | if ($response) { 57 | if (\Config::get('lowendping.archive.enabled', false)) { 58 | $response->update(array('sent' => 1)); 59 | } else { 60 | $response->delete(); 61 | } 62 | } 63 | 64 | $topic = $this->subscribedTopics[$entryData['query_id']]; 65 | 66 | // re-send the data to all the clients subscribed to that category 67 | $topic->broadcast($entryData); 68 | } 69 | } -------------------------------------------------------------------------------- /app/models/Query.php: -------------------------------------------------------------------------------- 1 | hasMany('QueryResponse'); 14 | } 15 | } -------------------------------------------------------------------------------- /app/models/QueryResponse.php: -------------------------------------------------------------------------------- 1 | where('sent', '=', '0'); 14 | } 15 | 16 | public function serverQuery() { 17 | return $this->belongsTo('Query'); 18 | } 19 | } -------------------------------------------------------------------------------- /app/models/RateLimit.php: -------------------------------------------------------------------------------- 1 | getKey(); 30 | } 31 | 32 | /** 33 | * Get the password for the user. 34 | * 35 | * @return string 36 | */ 37 | public function getAuthPassword() 38 | { 39 | return $this->password; 40 | } 41 | 42 | /** 43 | * Get the e-mail address where password reminders are sent. 44 | * 45 | * @return string 46 | */ 47 | public function getReminderEmail() 48 | { 49 | return $this->email; 50 | } 51 | 52 | } -------------------------------------------------------------------------------- /app/routes.php: -------------------------------------------------------------------------------- 1 | client->request('GET', '/'); 13 | 14 | $this->assertTrue($this->client->getResponse()->isOk()); 15 | } 16 | 17 | } -------------------------------------------------------------------------------- /app/tests/TestCase.php: -------------------------------------------------------------------------------- 1 | getData(); 5 | 6 | if (empty($data['type'])) { 7 | return false; 8 | } 9 | 10 | $iptype = endsWith($data['type'], '6') ? 6 : 4; 11 | 12 | // Check for IP address first 13 | if (!$this->checkAddressType($value, $iptype)) { 14 | $check = @dns_get_record($value, $iptype == 4 ? DNS_A : DNS_AAAA); 15 | 16 | $field = $iptype == 4 ? 'ip' : 'ipv6'; 17 | 18 | if (empty($check) || empty($check[0]) || empty($check[0][$field])) { 19 | return false; // Failed to resolve 20 | } 21 | 22 | $check = $check[0][$field]; 23 | 24 | if (!$check || !$this->checkAddressType($check, $iptype)) { 25 | return false; 26 | } 27 | } 28 | 29 | return true; 30 | } 31 | 32 | public function validateServer($attribute, $value, $parameters) { 33 | return array_key_exists($value, Config::get('lowendping.servers')); 34 | } 35 | 36 | public function validateType($attribute, $value, $parameters) { 37 | return array_key_exists($value, Config::get('lowendping.querytypes')); 38 | } 39 | 40 | private function checkAddressType($query, $type = 4) { 41 | if ($type == 4 && filter_var($query, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) && $query != '255.255.255.255') { 42 | return true; 43 | } else if ($type == 6 && filter_var($query, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { 44 | return true; 45 | } 46 | return false; 47 | } 48 | } 49 | 50 | Validator::resolver(function($translator, $data, $rules, $messages) { 51 | return new QueryValidator($translator, $data, $rules, $messages); 52 | }); 53 | 54 | function endsWith($haystack, $needle) { 55 | $length = strlen($needle); 56 | if ($length == 0) { 57 | return true; 58 | } 59 | 60 | return (substr($haystack, -$length) === $needle); 61 | } -------------------------------------------------------------------------------- /app/views/emails/auth/reminder.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 |{{{ $response->response }}}19 |
' + data.data + '
' + response.data + '
>>0;e=arguments;if(1>=e.length)for(;;){if(f in b){d=b[f++];break}if(++f>=c)throw new TypeError;}else d=e[1];for(;f>>2]|=(e[c>>>2]>>>24-8*(c%4)&255)<<24-8*((d+c)%4);else if(65535 >>2]=e[c>>>2];else b.push.apply(b,e);this.sigBytes+=a;return this},clamp:function(){var a= 43 | this.words,b=this.sigBytes;a[b>>>2]&=4294967295<<32-8*(b%4);a.length=c.ceil(b/4)},clone:function(){var a=d.clone.call(this);a.words=this.words.slice(0);return a},random:function(a){for(var b=[],e=0;e>>2]>>>24-8*(d%4)&255;e.push((c>>>4).toString(16));e.push((c&15).toString(16))}return e.join("")},parse:function(a){for(var b=a.length, 44 | e=[],d=0;d>>3]|=parseInt(a.substr(d,2),16)<<24-4*(d%8);return new h.init(e,b/2)}},l=f.Latin1={stringify:function(a){var b=a.words;a=a.sigBytes;for(var e=[],d=0;d>>2]>>>24-8*(d%4)&255));return e.join("")},parse:function(a){for(var b=a.length,e=[],d=0;d>>2]|=(a.charCodeAt(d)&255)<<24-8*(d%4);return new h.init(e,b)}},t=f.Utf8={stringify:function(a){try{return decodeURIComponent(escape(l.stringify(a)))}catch(b){throw Error("Malformed UTF-8 data"); 45 | }},parse:function(a){return l.parse(unescape(encodeURIComponent(a)))}},k=b.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new h.init;this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=t.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(a){var b=this._data,e=b.words,d=b.sigBytes,f=this.blockSize,l=d/(4*f),l=a?c.ceil(l):c.max((l|0)-this._minBufferSize,0);a=l*f;d=c.min(4*a,d);if(a){for(var k=0;k>>2]>>>24-8*(f%4)&255)<<16|(b[f+1>>>2]>>>24-8*((f+1)%4)&255)<<8|b[f+2>>>2]>>>24-8*((f+2)%4)&255,l=0;4>l&&f+0.75*l >>6*(3-l)&63));if(b=c.charAt(64))for(;a.length%4;)a.push(b);return a.join("")},parse:function(a){var b=a.length,d=this._map,c=d.charAt(64);c&&(c=a.indexOf(c),-1!=c&&(b=c));for(var c=[],f=0,e=0;e< 48 | b;e++)if(e%4){var l=d.indexOf(a.charAt(e-1))<<2*(e%4),t=d.indexOf(a.charAt(e))>>>6-2*(e%4);c[f>>>2]|=(l|t)<<24-8*(f%4);f++}return g.create(c,f)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}})();(function(){var c=CryptoJS,g=c.enc.Utf8;c.algo.HMAC=c.lib.Base.extend({init:function(a,b){a=this._hasher=new a.init;"string"==typeof b&&(b=g.parse(b));var d=a.blockSize,c=4*d;b.sigBytes>c&&(b=a.finalize(b));b.clamp();for(var f=this._oKey=b.clone(),e=this._iKey=b.clone(),l=f.words,t=e.words,k=0;k d;)a(e)&&(8>d&&(h[d]=b(c.pow(e,0.5))),f[d]=b(c.pow(e,1/3)),d++),e++})();var e=[],a=a.SHA256=d.extend({_doReset:function(){this._hash=new b.init(h.slice(0))},_doProcessBlock:function(a,b){for(var d=this._hash.words,c=d[0],h=d[1],g=d[2],m=d[3],n=d[4],u=d[5],y=d[6],x=d[7],p= 50 | 0;64>p;p++){if(16>p)e[p]=a[b+p]|0;else{var v=e[p-15],s=e[p-2];e[p]=((v<<25|v>>>7)^(v<<14|v>>>18)^v>>>3)+e[p-7]+((s<<15|s>>>17)^(s<<13|s>>>19)^s>>>10)+e[p-16]}v=x+((n<<26|n>>>6)^(n<<21|n>>>11)^(n<<7|n>>>25))+(n&u^~n&y)+f[p]+e[p];s=((c<<30|c>>>2)^(c<<19|c>>>13)^(c<<10|c>>>22))+(c&h^c&g^h&g);x=y;y=u;u=n;n=m+v|0;m=g;g=h;h=c;c=v+s|0}d[0]=d[0]+c|0;d[1]=d[1]+h|0;d[2]=d[2]+g|0;d[3]=d[3]+m|0;d[4]=d[4]+n|0;d[5]=d[5]+u|0;d[6]=d[6]+y|0;d[7]=d[7]+x|0},_doFinalize:function(){var a=this._data,b=a.words,d=8*this._nDataBytes, 51 | e=8*a.sigBytes;b[e>>>5]|=128<<24-e%32;b[(e+64>>>9<<4)+14]=c.floor(d/4294967296);b[(e+64>>>9<<4)+15]=d;a.sigBytes=4*b.length;this._process();return this._hash},clone:function(){var a=d.clone.call(this);a._hash=this._hash.clone();return a}});g.SHA256=d._createHelper(a);g.HmacSHA256=d._createHmacHelper(a)})(Math);(function(){var c=CryptoJS,g=c.lib,a=g.Base,b=g.WordArray,g=c.algo,d=g.HMAC,h=g.PBKDF2=a.extend({cfg:a.extend({keySize:4,hasher:g.SHA1,iterations:1}),init:function(a){this.cfg=this.cfg.extend(a)},compute:function(a,e){for(var c=this.cfg,h=d.create(c.hasher,a),g=b.create(),z=b.create([1]),A=g.words,q=z.words,m=c.keySize,c=c.iterations;A.length >>0;if(0===c)return-1;var f=0;0 =c)return-1;for(f=0<=f?f:Math.max(c-Math.abs(f),0);f >>0;if("[object Function]"!=={}.toString.call(a))throw new TypeError(a+" is not a function");d&&(c=d);for(f=0;f d&&(d=e.length);c=e.slice(a,d).split(c);e=c[1].split(".");for(d=0;d this.$items.length-1||0>b?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){c.to(b)}):d==b?this.pause().cycle():this.slide(b>d?"next":"prev",a(this.$items[b]))},b.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},b.prototype.next=function(){return this.sliding?void 0:this.slide("next")},b.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},b.prototype.slide=function(b,c){var d=this.$element.find(".item.active"),e=c||d[b](),f=this.interval,g="next"==b?"left":"right",h="next"==b?"first":"last",i=this;if(!e.length){if(!this.options.wrap)return;e=this.$element.find(".item")[h]()}if(e.hasClass("active"))return this.sliding=!1;var j=a.Event("slide.bs.carousel",{relatedTarget:e[0],direction:g});return this.$element.trigger(j),j.isDefaultPrevented()?void 0:(this.sliding=!0,f&&this.pause(),this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid.bs.carousel",function(){var b=a(i.$indicators.children()[i.getActiveIndex()]);b&&b.addClass("active")})),a.support.transition&&this.$element.hasClass("slide")?(e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),d.one(a.support.transition.end,function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger("slid.bs.carousel")},0)}).emulateTransitionEnd(1e3*d.css("transition-duration").slice(0,-1))):(d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger("slid.bs.carousel")),f&&this.cycle(),this)};var c=a.fn.carousel;a.fn.carousel=function(c){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c),g="string"==typeof c?c:f.slide;e||d.data("bs.carousel",e=new b(this,f)),"number"==typeof c?e.to(c):g?e[g]():f.interval&&e.pause().cycle()})},a.fn.carousel.Constructor=b,a.fn.carousel.noConflict=function(){return a.fn.carousel=c,this},a(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(b){var c,d=a(this),e=a(d.attr("data-target")||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"")),f=a.extend({},e.data(),d.data()),g=d.attr("data-slide-to");g&&(f.interval=!1),e.carousel(f),(g=d.attr("data-slide-to"))&&e.data("bs.carousel").to(g),b.preventDefault()}),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var b=a(this);b.carousel(b.data())})})}(jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d),this.transitioning=null,this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.DEFAULTS={toggle:!0},b.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},b.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b=a.Event("show.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.$parent&&this.$parent.find("> .panel > .in");if(c&&c.length){var d=c.data("bs.collapse");if(d&&d.transitioning)return;c.collapse("hide"),d||c.data("bs.collapse",null)}var e=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[e](0),this.transitioning=1;var f=function(){this.$element.removeClass("collapsing").addClass("collapse in")[e]("auto"),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return f.call(this);var g=a.camelCase(["scroll",e].join("-"));this.$element.one(a.support.transition.end,a.proxy(f,this)).emulateTransitionEnd(350)[e](this.$element[0][g])}}},b.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var d=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};return a.support.transition?void this.$element[c](0).one(a.support.transition.end,a.proxy(d,this)).emulateTransitionEnd(350):d.call(this)}}},b.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var c=a.fn.collapse;a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("bs.collapse"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c);!e&&f.toggle&&"show"==c&&(c=!c),e||d.data("bs.collapse",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.collapse.Constructor=b,a.fn.collapse.noConflict=function(){return a.fn.collapse=c,this},a(document).on("click.bs.collapse.data-api","[data-toggle=collapse]",function(b){var c,d=a(this),e=d.attr("data-target")||b.preventDefault()||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,""),f=a(e),g=f.data("bs.collapse"),h=g?"toggle":d.data(),i=d.attr("data-parent"),j=i&&a(i);g&&g.transitioning||(j&&j.find('[data-toggle=collapse][data-parent="'+i+'"]').not(d).addClass("collapsed"),d[f.hasClass("in")?"addClass":"removeClass"]("collapsed")),f.collapse(h)})}(jQuery),+function(a){"use strict";function b(b){a(d).remove(),a(e).each(function(){var d=c(a(this)),e={relatedTarget:this};d.hasClass("open")&&(d.trigger(b=a.Event("hide.bs.dropdown",e)),b.isDefaultPrevented()||d.removeClass("open").trigger("hidden.bs.dropdown",e))})}function c(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}var d=".dropdown-backdrop",e="[data-toggle=dropdown]",f=function(b){a(b).on("click.bs.dropdown",this.toggle)};f.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=c(e),g=f.hasClass("open");if(b(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a('').insertAfter(a(this)).on("click",b);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;f.toggleClass("open").trigger("shown.bs.dropdown",h),e.focus()}return!1}},f.prototype.keydown=function(b){if(/(38|40|27)/.test(b.keyCode)){var d=a(this);if(b.preventDefault(),b.stopPropagation(),!d.is(".disabled, :disabled")){var f=c(d),g=f.hasClass("open");if(!g||g&&27==b.keyCode)return 27==b.which&&f.find(e).focus(),d.click();var h=" li:not(.divider):visible a",i=f.find("[role=menu]"+h+", [role=listbox]"+h);if(i.length){var j=i.index(i.filter(":focus"));38==b.keyCode&&j>0&&j--,40==b.keyCode&&j ').appendTo(document.body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(a){a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus.call(this.$element[0]):this.hide.call(this))},this)),d&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;d?this.$backdrop.one(a.support.transition.end,b).emulateTransitionEnd(150):b()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(a.support.transition.end,b).emulateTransitionEnd(150):b()):b&&b()};var c=a.fn.modal;a.fn.modal=function(c,d){return this.each(function(){var e=a(this),f=e.data("bs.modal"),g=a.extend({},b.DEFAULTS,e.data(),"object"==typeof c&&c);f||e.data("bs.modal",f=new b(this,g)),"string"==typeof c?f[c](d):g.show&&f.show(d)})},a.fn.modal.Constructor=b,a.fn.modal.noConflict=function(){return a.fn.modal=c,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(b){var c=a(this),d=c.attr("href"),e=a(c.attr("data-target")||d&&d.replace(/.*(?=#[^\s]+$)/,"")),f=e.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(d)&&d},e.data(),c.data());c.is("a")&&b.preventDefault(),e.modal(f,this).one("hide",function(){c.is(":visible")&&c.focus()})}),a(document).on("show.bs.modal",".modal",function(){a(document.body).addClass("modal-open")}).on("hidden.bs.modal",".modal",function(){a(document.body).removeClass("modal-open")})}(jQuery),+function(a){"use strict";var b=function(a,b){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null,this.init("tooltip",a,b)};b.DEFAULTS={animation:!0,placement:"top",selector:!1,template:' ',trigger:"hover focus",title:"",delay:0,html:!1,container:!1},b.prototype.init=function(b,c,d){this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d);for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},b.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},b.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);return clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show()},b.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);return clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide()},b.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){if(this.$element.trigger(b),b.isDefaultPrevented())return;var c=this,d=this.tip();this.setContent(),this.options.animation&&d.addClass("fade");var e="function"==typeof this.options.placement?this.options.placement.call(this,d[0],this.$element[0]):this.options.placement,f=/\s?auto?\s?/i,g=f.test(e);g&&(e=e.replace(f,"")||"top"),d.detach().css({top:0,left:0,display:"block"}).addClass(e),this.options.container?d.appendTo(this.options.container):d.insertAfter(this.$element);var h=this.getPosition(),i=d[0].offsetWidth,j=d[0].offsetHeight;if(g){var k=this.$element.parent(),l=e,m=document.documentElement.scrollTop||document.body.scrollTop,n="body"==this.options.container?window.innerWidth:k.outerWidth(),o="body"==this.options.container?window.innerHeight:k.outerHeight(),p="body"==this.options.container?0:k.offset().left;e="bottom"==e&&h.top+h.height+j-m>o?"top":"top"==e&&h.top-m-j<0?"bottom":"right"==e&&h.right+i>n?"left":"left"==e&&h.left-i'}),b.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),b.prototype.constructor=b,b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content")[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},b.prototype.hasContent=function(){return this.getTitle()||this.getContent()},b.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},b.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},b.prototype.tip=function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip};var c=a.fn.popover;a.fn.popover=function(c){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof c&&c;(e||"destroy"!=c)&&(e||d.data("bs.popover",e=new b(this,f)),"string"==typeof c&&e[c]())})},a.fn.popover.Constructor=b,a.fn.popover.noConflict=function(){return a.fn.popover=c,this}}(jQuery),+function(a){"use strict";function b(c,d){var e,f=a.proxy(this.process,this);this.$element=a(a(c).is("body")?window:c),this.$body=a("body"),this.$scrollElement=this.$element.on("scroll.bs.scroll-spy.data-api",f),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||(e=a(c).attr("href"))&&e.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.offsets=a([]),this.targets=a([]),this.activeTarget=null,this.refresh(),this.process()}b.DEFAULTS={offset:10},b.prototype.refresh=function(){var b=this.$element[0]==window?"offset":"position";this.offsets=a([]),this.targets=a([]);{var c=this;this.$body.find(this.selector).map(function(){var d=a(this),e=d.data("target")||d.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[b]().top+(!a.isWindow(c.$scrollElement.get(0))&&c.$scrollElement.scrollTop()),e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){c.offsets.push(this[0]),c.targets.push(this[1])})}},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,d=c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(b>=d)return g!=(a=f.last()[0])&&this.activate(a);if(g&&b<=e[0])return g!=(a=f[0])&&this.activate(a);for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(!e[a+1]||b<=e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,a(this.selector).parentsUntil(this.options.target,".active").removeClass("active");var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")};var c=a.fn.scrollspy;a.fn.scrollspy=function(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=c,this},a(window).on("load",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);b.scrollspy(b.data())})})}(jQuery),+function(a){"use strict";var b=function(b){this.element=a(b)};b.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a")[0],f=a.Event("show.bs.tab",{relatedTarget:e});if(b.trigger(f),!f.isDefaultPrevented()){var g=a(d);this.activate(b.parent("li"),c),this.activate(g,g.parent(),function(){b.trigger({type:"shown.bs.tab",relatedTarget:e})})}}},b.prototype.activate=function(b,c,d){function e(){f.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),g?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var f=c.find("> .active"),g=d&&a.support.transition&&f.hasClass("fade");g?f.one(a.support.transition.end,e).emulateTransitionEnd(150):e(),f.removeClass("in")};var c=a.fn.tab;a.fn.tab=function(c){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new b(this)),"string"==typeof c&&e[c]()})},a.fn.tab.Constructor=b,a.fn.tab.noConflict=function(){return a.fn.tab=c,this},a(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(b){b.preventDefault(),a(this).tab("show")})}(jQuery),+function(a){"use strict";var b=function(c,d){this.options=a.extend({},b.DEFAULTS,d),this.$window=a(window).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(c),this.affixed=this.unpin=this.pinnedOffset=null,this.checkPosition()};b.RESET="affix affix-top affix-bottom",b.DEFAULTS={offset:0},b.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(b.RESET).addClass("affix");var a=this.$window.scrollTop(),c=this.$element.offset();return this.pinnedOffset=c.top-a},b.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},b.prototype.checkPosition=function(){if(this.$element.is(":visible")){var c=a(document).height(),d=this.$window.scrollTop(),e=this.$element.offset(),f=this.options.offset,g=f.top,h=f.bottom;"top"==this.affixed&&(e.top+=d),"object"!=typeof f&&(h=g=f),"function"==typeof g&&(g=f.top(this.$element)),"function"==typeof h&&(h=f.bottom(this.$element));var i=null!=this.unpin&&d+this.unpin<=e.top?!1:null!=h&&e.top+this.$element.height()>=c-h?"bottom":null!=g&&g>=d?"top":!1;if(this.affixed!==i){this.unpin&&this.$element.css("top","");var j="affix"+(i?"-"+i:""),k=a.Event(j+".bs.affix");this.$element.trigger(k),k.isDefaultPrevented()||(this.affixed=i,this.unpin="bottom"==i?this.getPinnedOffset():null,this.$element.removeClass(b.RESET).addClass(j).trigger(a.Event(j.replace("affix","affixed"))),"bottom"==i&&this.$element.offset({top:c-h-this.$element.height()}))}}};var c=a.fn.affix;a.fn.affix=function(c){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof c&&c;e||d.data("bs.affix",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.affix.Constructor=b,a.fn.affix.noConflict=function(){return a.fn.affix=c,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var b=a(this),c=b.data();c.offset=c.offset||{},c.offsetBottom&&(c.offset.bottom=c.offsetBottom),c.offsetTop&&(c.offset.top=c.offsetTop),b.affix(c)})})}(jQuery); -------------------------------------------------------------------------------- /public/packages/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nikkiii/lowendping/15321d82459048afa9d7aa85f70ab58baacc02ac/public/packages/.gitkeep -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | ## LowEndPing Network Status 2 | 3 | LowEndPing is a simple network query script. 4 | 5 | Installation: 6 | 7 | - Install Composer 8 | - Download the contents and extract into a directory 9 | - Run "composer install" in that directory 10 | - Run "php artisan migrate" to initialize the database 11 | - Install the python script on the servers you want (see below) 12 | - Edit app/config/lowendping.php and add the servers (Numeric keys are required, and it is recommended to keep them in order), and optionally disable the archive 13 | - Add "cd /path/to/lowendping; php artisan lowendping:archive" to a cron job, every hour or daily would be fine. This is required even without the archive to clean up old queries. 14 | - Edit your webserver configuration and set the document root to (install dir)/public, then add a rewrite rule for laravel (Use google, there's plenty out there) 15 | - Try it out! 16 | 17 | Python script installation: 18 | 19 | - Install python, python-pip, and mtr-tiny 20 | - Run 'pip install sh' (the required shell wrapper) and 'pip install ipaddress' (required only if python 2.7 instead of python 3) 21 | - Update the information in lepconf.py to point to your server and define an auth token 22 | - Run 'python lep.py' (It is recommended to run it as a user other than root of course) 23 | 24 | ### Websockets 25 | 26 | Websockets will allow LowEndPing to give instant responses. It requires a bit more configuration, and is probably only really worth it when running a LowEndPing installation with more than 10 servers or a lot of traffic. 27 | 28 | To use Websockets, install the following packages (along with a c compiler, gcc will work just fine): 29 | 30 | Debian: 31 | 32 | apt-get install libzmq1 libzmq-dev 33 | 34 | Then, install php-zmq 35 | 36 | 37 | git clone git://github.com/mkoppanen/php-zmq.git 38 | cd php-zmq 39 | phpize && ./configure 40 | make && make install 41 | echo "extension=zmq.so" > /etc/php5/conf.d/zmq.ini 42 | 43 | 44 | To install the libraries needed in PHP you must add the following to composer.json's "require" section, and run "composer update" 45 | 46 | 47 | "cboden/Ratchet": "0.3.*", 48 | "react/zmq": "0.2.*" 49 | 50 | 51 | And then start "php artisan lowendping:websocket" and restart your webserver/php5. 52 | 53 | Then, set websocket.enabled to "true" in app/config/lowendping.php, and modify the port if you wish. Websockets should now work, verify it by opening your url and the Network console in Chrome/Firefox, and watch for "Switching Protocols" when submitting a query. 54 | 55 | It is also suggested to start the server using supervisord, just any standard config running the above command will work. 56 | 57 | ### License 58 | 59 | The Laravel framework is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT) 60 | 61 | LowEndPing is also open-source and licensed under the same license. -------------------------------------------------------------------------------- /server.php: -------------------------------------------------------------------------------- 1 |