This repository has been archived by the owner on Mar 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
root
committed
Apr 23, 2018
0 parents
commit f928aed
Showing
118 changed files
with
39,623 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
APP_NAME=Laravel | ||
APP_ENV=local | ||
APP_KEY= | ||
APP_DEBUG=true | ||
APP_URL=http://localhost | ||
|
||
LOG_CHANNEL=stack | ||
|
||
DB_CONNECTION=mysql | ||
DB_HOST=127.0.0.1 | ||
DB_PORT=3306 | ||
DB_DATABASE=homestead | ||
DB_USERNAME=homestead | ||
DB_PASSWORD=secret | ||
|
||
BROADCAST_DRIVER=log | ||
CACHE_DRIVER=file | ||
SESSION_DRIVER=file | ||
SESSION_LIFETIME=120 | ||
QUEUE_DRIVER=sync | ||
|
||
REDIS_HOST=127.0.0.1 | ||
REDIS_PASSWORD=null | ||
REDIS_PORT=6379 | ||
|
||
MAIL_DRIVER=smtp | ||
MAIL_HOST=smtp.mailtrap.io | ||
MAIL_PORT=2525 | ||
MAIL_USERNAME=null | ||
MAIL_PASSWORD=null | ||
MAIL_ENCRYPTION=null | ||
|
||
PUSHER_APP_ID= | ||
PUSHER_APP_KEY= | ||
PUSHER_APP_SECRET= | ||
PUSHER_APP_CLUSTER=mt1 | ||
|
||
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" | ||
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
* text=auto | ||
*.css linguist-vendored | ||
*.scss linguist-vendored | ||
*.js linguist-vendored | ||
CHANGELOG.md export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/node_modules | ||
/public/hot | ||
/public/storage | ||
/storage/*.key | ||
/vendor | ||
/.idea | ||
/.vscode | ||
/.vagrant | ||
Homestead.json | ||
Homestead.yaml | ||
npm-debug.log | ||
yarn-error.log | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
namespace App\Console; | ||
|
||
use Illuminate\Console\Scheduling\Schedule; | ||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel; | ||
|
||
class Kernel extends ConsoleKernel | ||
{ | ||
/** | ||
* The Artisan commands provided by your application. | ||
* | ||
* @var array | ||
*/ | ||
protected $commands = [ | ||
// | ||
]; | ||
|
||
/** | ||
* Define the application's command schedule. | ||
* | ||
* @param \Illuminate\Console\Scheduling\Schedule $schedule | ||
* @return void | ||
*/ | ||
protected function schedule(Schedule $schedule) | ||
{ | ||
// $schedule->command('inspire') | ||
// ->hourly(); | ||
} | ||
|
||
/** | ||
* Register the commands for the application. | ||
* | ||
* @return void | ||
*/ | ||
protected function commands() | ||
{ | ||
$this->load(__DIR__.'/Commands'); | ||
|
||
require base_path('routes/console.php'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
namespace App\Exceptions; | ||
|
||
use Exception; | ||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; | ||
|
||
class Handler extends ExceptionHandler | ||
{ | ||
/** | ||
* A list of the exception types that are not reported. | ||
* | ||
* @var array | ||
*/ | ||
protected $dontReport = [ | ||
// | ||
]; | ||
|
||
/** | ||
* A list of the inputs that are never flashed for validation exceptions. | ||
* | ||
* @var array | ||
*/ | ||
protected $dontFlash = [ | ||
'password', | ||
'password_confirmation', | ||
]; | ||
|
||
/** | ||
* Report or log an exception. | ||
* | ||
* This is a great spot to send exceptions to Sentry, Bugsnag, etc. | ||
* | ||
* @param \Exception $exception | ||
* @return void | ||
*/ | ||
public function report(Exception $exception) | ||
{ | ||
parent::report($exception); | ||
} | ||
|
||
/** | ||
* Render an exception into an HTTP response. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @param \Exception $exception | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function render($request, Exception $exception) | ||
{ | ||
return parent::render($request, $exception); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use App\Http\Controllers\Controller; | ||
use Illuminate\Http\Request; | ||
use App\User; | ||
use SSH; | ||
|
||
class AccessController extends Controller | ||
{ | ||
|
||
public function __construct() | ||
{ | ||
//$this->middleware('guest')->except('logout'); | ||
} | ||
|
||
/** Системные данные */ | ||
public function getHome (Request $request, $user, $uuid) { | ||
// Выбираем пользователя, если пользователья нет - выводим ошибку | ||
$user = User::where('user', $user)->where('uuid', $uuid)->first(); | ||
if (!$user) abort(403); | ||
|
||
return view('access', [ | ||
'user' => $user, | ||
'telegram' => 'socks?server=' . urlencode(env('PROXY_SERVER')) . '&port=' . urlencode(env('PROXY_PORT')) . '&user=' . urlencode($user->user) . '&pass=' . urlencode($user->password) | ||
]); | ||
} | ||
|
||
/** Смена пароля */ | ||
public function postPassword (Request $request, $user, $uuid) { | ||
// Выбираем пользователя, если пользователья нет - выводим ошибку | ||
$user = User::where('user', $user)->where('uuid', $uuid)->first(); | ||
if (!$user) abort(403); | ||
|
||
// Генерируем новый пароль и сохраняем | ||
$user->password = false; | ||
$user->update(); | ||
|
||
// Устанавливаем пароль | ||
SSH::run([ 'usermod --password "' . addslashes($user->password) . '" "' . addslashes($user->user) . '"' ]); | ||
|
||
return response()->json($user->password); | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use Illuminate\Foundation\Bus\DispatchesJobs; | ||
use Illuminate\Routing\Controller as BaseController; | ||
use Illuminate\Foundation\Validation\ValidatesRequests; | ||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests; | ||
|
||
class Controller extends BaseController | ||
{ | ||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use Symfony\Component\HttpFoundation\Response; | ||
use App\Http\Controllers\Controller; | ||
use Illuminate\Http\Request; | ||
use App\User; | ||
|
||
class HomeController extends Controller | ||
{ | ||
|
||
public function __construct() | ||
{ | ||
//$this->middleware('guest')->except('logout'); | ||
} | ||
|
||
/** Авторизация */ | ||
public function getHome (Request $request) { | ||
// Если вошли - идем на страницу системных настроек | ||
if ($request->cookie('password') == env('APP_PASSWORD')) { | ||
return redirect()->route('system'); | ||
} | ||
// Форма авторизации | ||
return view('auth'); | ||
} | ||
|
||
// Подтверждение авторизации | ||
public function postAuth (Request $request) { | ||
// Если пароль указан не верно | ||
if ($request->input('password', '') !== env('APP_PASSWORD')) { | ||
return response()->json([ | ||
'error' => 'Пароль указан неверно' | ||
], Response::HTTP_BAD_REQUEST); | ||
} | ||
// Авторизируемся | ||
return response()->json(true)->cookie( | ||
cookie('password', $request->input('password', ''), 240) | ||
); | ||
} | ||
|
||
// Выход из аккаунта | ||
public function getLogout (Request $request) { | ||
return redirect()->route('home')->cookie(cookie('password', '', 1)); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use App\Http\Controllers\Controller; | ||
use Illuminate\Http\Request; | ||
use App\User; | ||
use SSH; | ||
|
||
class SystemController extends Controller | ||
{ | ||
public function __construct() | ||
{ | ||
//$this->middleware('guest')->except('logout'); | ||
} | ||
|
||
|
||
/** Системные данные */ | ||
public function getHome () { | ||
return view('system'); | ||
} | ||
|
||
/** Env данные */ | ||
public function getEnv () { | ||
return response()->json([ | ||
'PROXY_SERVER' => env('PROXY_SERVER'), | ||
'PROXY_PORT' => env('PROXY_PORT'), | ||
'PROXY_GROUP' => env('PROXY_GROUP'), | ||
'PROXY_USER' => env('PROXY_USER'), | ||
'PROXY_PASSWORD' => env('PROXY_PASSWORD'), | ||
'APP_PASSWORD' => env('APP_PASSWORD') | ||
]); | ||
} | ||
|
||
/** Статус группы */ | ||
public function getGroup () { | ||
// Статус (Есть или нет пользователь) | ||
$this->status = false; | ||
// Проверяем наличае группы | ||
SSH::run([ 'grep "' . addslashes(env('PROXY_GROUP')) . ':*" /etc/group' ], function ($line) { | ||
if (trim($line) != '') { | ||
$this->status = true; | ||
} | ||
}); | ||
// Возвращаем результат | ||
return response()->json($this->status); | ||
} | ||
|
||
/** Создание группы если её нету */ | ||
public function postGroup () { | ||
// Создался ли пользователь | ||
$this->status = false; | ||
// Пробуем создать и проверяем создалась ли группа | ||
SSH::run([ | ||
'groupadd "' . addslashes(env('PROXY_GROUP')) . '" >/dev/null 2>/dev/null', | ||
'grep "' . addslashes(env('PROXY_GROUP')) . ':*" /etc/group' | ||
], function ($line) { | ||
if (trim($line) != '') { | ||
$this->status = true; | ||
} | ||
}); | ||
// Возвращаем результат | ||
return response()->json($this->status); | ||
} | ||
|
||
/** Статус подключения к серверу */ | ||
public function getServer () { | ||
// Аптайм | ||
$this->uptime = false; | ||
// Получение аптайма сервера | ||
|
||
SSH::run([ 'uptime' ], function ($line) { | ||
$this->uptime = $line; | ||
}); | ||
// Возвращаем результат | ||
return response()->json($this->uptime); | ||
} | ||
|
||
/** Перезапустить Dante */ | ||
public function postRestart () { | ||
SSH::run([ | ||
'sudo systemctl restart danted', | ||
'/etc/init.d/danted restart', | ||
'systemctl start sockd.service' | ||
]); | ||
} | ||
|
||
/** Перезагрузка */ | ||
public function postReboot () { | ||
SSH::run([ | ||
'sudo reboot' | ||
]); | ||
} | ||
|
||
|
||
} |
Oops, something went wrong.