-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added some fun privledge escalation!
- Loading branch information
Katie Paxton-Fear
authored and
Katie Paxton-Fear
committed
Jun 7, 2020
1 parent
486dea6
commit 9bc855d
Showing
6 changed files
with
105 additions
and
5 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,47 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use App\Grade; | ||
use App\Role; | ||
use App\UniClass; | ||
use App\User; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\Auth; | ||
use Illuminate\Support\Facades\DB; | ||
|
||
class AdminController extends Controller | ||
{ | ||
public function index() | ||
{ | ||
return "secret ;)"; | ||
} | ||
|
||
public function delete() | ||
{ | ||
if(Auth::user()->role_id == 1) { | ||
DB::table('users')->where('id', '<>', Auth::user()->id)->delete(); | ||
UniClass::truncate(); | ||
Grade::truncate(); | ||
|
||
return "deleted everything ;)"; | ||
} else { | ||
|
||
return "permission required :("; | ||
} | ||
|
||
} | ||
public function repopulate() | ||
{ | ||
if(Auth::user()->role_id == 1) { | ||
$dbseed = new \DatabaseSeeder(); | ||
$dbseed->run(); | ||
|
||
return "database repopulated"; | ||
} else { | ||
|
||
return "permission required :("; | ||
} | ||
|
||
} | ||
} |
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\Role; | ||
use Illuminate\Http\Request; | ||
|
||
class RoleController extends Controller | ||
{ | ||
|
||
private $model = Role::class; | ||
|
||
public function __construct() | ||
{ | ||
$this->model = \App::make($this->model); | ||
} | ||
|
||
function index() | ||
{ | ||
return $this->model::all(); | ||
} | ||
|
||
function store(Request $request) | ||
{ | ||
return $this->model->create($request->input()); | ||
} | ||
|
||
function show($id) | ||
{ | ||
return $this->model->find($id); | ||
} | ||
|
||
function update(Request $request, $id) | ||
{ | ||
|
||
if ($model = $this->model->find($id)) { | ||
$model->update($request->input()); | ||
return $model; | ||
} | ||
return json_encode('Resource: ' . $id . ' with presented ID does not exist.'); | ||
} | ||
|
||
function destroy($id) | ||
{ | ||
return $this->model->destroy($id); | ||
} | ||
} |
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
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
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
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