Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
abaykan committed Apr 4, 2020
0 parents commit 413bf48
Show file tree
Hide file tree
Showing 109 changed files with 19,125 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2
20 changes: 20 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
APP_NAME=Carina
APP_ENV=local
APP_KEY=base64:gMspaWpQJJMJH7SAUJrL91D+M8mY8ej1Re+CEj4k3hM=
APP_DEBUG=true
APP_URL=http://localhost/

LOG_CHANNEL=single

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=carina
DB_USERNAME=username
DB_PASSWORD=password

BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
5 changes: 5 additions & 0 deletions .gitattributes
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
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/node_modules
/public/hot
/public/storage
/storage/*.key
/vendor
.env
.phpunit.result.cache
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
13 changes: 13 additions & 0 deletions .styleci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
php:
preset: laravel
disabled:
- unused_use
finder:
not-name:
- index.php
- server.php
js:
finder:
not-name:
- webpack.mix.js
css: true
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<p align="center"><img src="https://assets.codelatte.net/20200405033953-carina.png" width="100%"></p>

<center>

![PHP Version](https://img.shields.io/badge/php-%5E%207.1.3-red)
![Github Stars](https://img.shields.io/github/stars/codelatte/carina.svg)
![Contributors Welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)
![Open Source](https://badges.frapsoft.com/os/v2/open-source.svg?v=103)
</center>

## About Carina

**Carina** is a web application used to store webshell, Virtual Private Server (VPS) and cPanel data. **Carina** is made so that we don't need to store webshell, VPS or cPanel data in "strange places".

## Screenshots

<img src="https://assets.codelatte.net/20200405041451-carina-1.png">
<img src="https://assets.codelatte.net/20200405041451-carina-2.png">
<img src="https://assets.codelatte.net/20200405041451-carina-3.png">
<img src="https://assets.codelatte.net/20200405041451-carina-4.png">

## Install Carina
1. ```$ git clone https://github.com/codelatte/carina && cd carina```
2. Run ```composer update```.
3. Edit ```.env.example``` with your database configuration.
4. Run ```php artisan migrate``` for generate required tables.
4. Run ```php artisan serve```.

## Contact

If you discover something stupid within Carina, please send an e-mail to us via [abay@codelatte.org](mailto:abay@codelatte.org).
42 changes: 42 additions & 0 deletions app/Console/Kernel.php
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');
}
}
55 changes: 55 additions & 0 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?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.
*
* @param \Exception $exception
* @return void
*
* @throws \Exception
*/
public function report(Exception $exception)
{
parent::report($exception);
}

/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $exception
* @return \Symfony\Component\HttpFoundation\Response
*
* @throws \Exception
*/
public function render($request, Exception $exception)
{
return parent::render($request, $exception);
}
}
91 changes: 91 additions & 0 deletions app/Helpers/Helper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?php

namespace App\Helpers;

use Symfony\Component\DomCrawler\Crawler;
use GuzzleHttp\Client;
use Log;

class Helper
{
public static function checkShell($url) {
$crawler = new Crawler();
$client = new \GuzzleHttp\Client();

try {
$r = $client->request('GET', $url);

$html = $r->getBody()->getContents();
$crawler->addHTMLContent($html);
$uname = $crawler->filterXpath('//*[@id="system_info"]');
$data['url'] = $url;

$data['domain'] = Helper::getDomain($url);

foreach ($uname as $key => $value) {
$data['server_info'] = trim($value->nodeValue);
}
$data['status'] = 'active';

return $data;
} catch (\Exception $e) {
return false;
}
}

public static function getDomain($url) {
$pecah_domain = explode('//', $url);
$pecah_domain2 = explode('/', end($pecah_domain));

$domain = $pecah_domain2[0];
return $domain;
}

public static function vpsCheck($host, $port, $username, $password) {
try {
$connection = ssh2_connect($host, $port);
} catch (\Exception $e) {
Log::error($e->getMessage());
$data['status'] = 'inactive';
return false;
}

try {
ssh2_auth_password($connection, $username, $password);
} catch (\Exception $e) {
Log::error($e->getMessage());
return false;
}
$stream = ssh2_exec($connection, "uname -a");
$stream2 = ssh2_exec($connection, "awk '/^Mem/ {print $2}' <(free -m)");
stream_set_blocking( $stream, TRUE);
stream_set_blocking( $stream2, TRUE);
$data['ip'] = $host;
$data['port'] = $port;
$data['user'] = $username;
$data['password'] = $password;
$data['server_info'] = str_replace("\n", '', stream_get_contents($stream));
$data['status'] = 'active';

return $data;
}

public static function cpanelCheck($domain, $port, $username, $password) {
$url = (($port == '2083') ? 'https' : 'http')."://".$domain.":".$port."/login/?login_only=1";

$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
"user=".$username."&pass=".$password."&goto=/");

$r = curl_exec($ch);
curl_close ($ch);
$output['status'] = json_decode($r, TRUE)['status'];
return $output;
}

}
40 changes: 40 additions & 0 deletions app/Http/Controllers/Auth/ConfirmPasswordController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\ConfirmsPasswords;

class ConfirmPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Confirm Password Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password confirmations and
| uses a simple trait to include the behavior. You're free to explore
| this trait and override any functions that require customization.
|
*/

use ConfirmsPasswords;

/**
* Where to redirect users when the intended url fails.
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;

/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}
}
22 changes: 22 additions & 0 deletions app/Http/Controllers/Auth/ForgotPasswordController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;

class ForgotPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset emails and
| includes a trait which assists in sending these notifications from
| your application to your users. Feel free to explore this trait.
|
*/

use SendsPasswordResetEmails;
}
40 changes: 40 additions & 0 deletions app/Http/Controllers/Auth/LoginController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\AuthenticatesUsers;

class LoginController extends Controller
{
/*
|--------------------------------------------------------------------------
| Login Controller
|--------------------------------------------------------------------------
|
| This controller handles authenticating users for the application and
| redirecting them to your home screen. The controller uses a trait
| to conveniently provide its functionality to your applications.
|
*/

use AuthenticatesUsers;

/**
* Where to redirect users after login.
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;

/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest')->except('logout');
}
}
Loading

0 comments on commit 413bf48

Please sign in to comment.