@@ -18,67 +18,67 @@ |
||
| 18 | 18 | |
| 19 | 19 | class PageConfirmEmail extends PublicInterfacePageBase |
| 20 | 20 | { |
| 21 | - /** |
|
| 22 | - * Main function for this page, when no specific actions are called. |
|
| 23 | - * @throws ApplicationLogicException |
|
| 24 | - * @throws Exception |
|
| 25 | - */ |
|
| 26 | - protected function main() |
|
| 27 | - { |
|
| 28 | - $id = WebRequest::getInt('id'); |
|
| 29 | - $si = WebRequest::getString('si'); |
|
| 30 | - |
|
| 31 | - if ($id === null || $si === null) { |
|
| 32 | - throw new ApplicationLogicException('Link incomplete - please double check the link you received.'); |
|
| 33 | - } |
|
| 34 | - |
|
| 35 | - /** @var Request|false $request */ |
|
| 36 | - $request = Request::getById($id, $this->getDatabase()); |
|
| 37 | - |
|
| 38 | - if ($request === false) { |
|
| 39 | - throw new ApplicationLogicException('Request not found'); |
|
| 40 | - } |
|
| 41 | - |
|
| 42 | - if ($request->getEmailConfirm() === 'Confirmed') { |
|
| 43 | - // request has already been confirmed. Bomb out silently. |
|
| 44 | - $this->redirect('requestSubmitted'); |
|
| 45 | - |
|
| 46 | - return; |
|
| 47 | - } |
|
| 48 | - |
|
| 49 | - if ($request->getEmailConfirm() === $si) { |
|
| 50 | - $request->setEmailConfirm('Confirmed'); |
|
| 51 | - } |
|
| 52 | - else { |
|
| 53 | - throw new ApplicationLogicException('The confirmation value does not appear to match the expected value'); |
|
| 54 | - } |
|
| 55 | - |
|
| 56 | - try { |
|
| 57 | - $request->save(); |
|
| 58 | - } |
|
| 59 | - catch (OptimisticLockFailedException $ex) { |
|
| 60 | - // Okay. Someone's edited this in the time between us loading this page and doing the checks, and us getting |
|
| 61 | - // to saving the page. We *do not* want to show an optimistic lock failure, the most likely problem is they |
|
| 62 | - // double-loaded this page (see #255). Let's confirm this, and bomb out with a success message if it's the |
|
| 63 | - // case. |
|
| 64 | - |
|
| 65 | - $request = Request::getById($id, $this->getDatabase()); |
|
| 66 | - if ($request->getEmailConfirm() === 'Confirmed') { |
|
| 67 | - // we've already done the sanity checks above |
|
| 68 | - |
|
| 69 | - $this->redirect('requestSubmitted'); |
|
| 70 | - |
|
| 71 | - // skip the log and notification |
|
| 72 | - return; |
|
| 73 | - } |
|
| 74 | - |
|
| 75 | - // something really weird happened. Another race condition? |
|
| 76 | - throw $ex; |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - Logger::emailConfirmed($this->getDatabase(), $request); |
|
| 80 | - $this->getNotificationHelper()->requestReceived($request); |
|
| 81 | - |
|
| 82 | - $this->redirect('requestSubmitted'); |
|
| 83 | - } |
|
| 21 | + /** |
|
| 22 | + * Main function for this page, when no specific actions are called. |
|
| 23 | + * @throws ApplicationLogicException |
|
| 24 | + * @throws Exception |
|
| 25 | + */ |
|
| 26 | + protected function main() |
|
| 27 | + { |
|
| 28 | + $id = WebRequest::getInt('id'); |
|
| 29 | + $si = WebRequest::getString('si'); |
|
| 30 | + |
|
| 31 | + if ($id === null || $si === null) { |
|
| 32 | + throw new ApplicationLogicException('Link incomplete - please double check the link you received.'); |
|
| 33 | + } |
|
| 34 | + |
|
| 35 | + /** @var Request|false $request */ |
|
| 36 | + $request = Request::getById($id, $this->getDatabase()); |
|
| 37 | + |
|
| 38 | + if ($request === false) { |
|
| 39 | + throw new ApplicationLogicException('Request not found'); |
|
| 40 | + } |
|
| 41 | + |
|
| 42 | + if ($request->getEmailConfirm() === 'Confirmed') { |
|
| 43 | + // request has already been confirmed. Bomb out silently. |
|
| 44 | + $this->redirect('requestSubmitted'); |
|
| 45 | + |
|
| 46 | + return; |
|
| 47 | + } |
|
| 48 | + |
|
| 49 | + if ($request->getEmailConfirm() === $si) { |
|
| 50 | + $request->setEmailConfirm('Confirmed'); |
|
| 51 | + } |
|
| 52 | + else { |
|
| 53 | + throw new ApplicationLogicException('The confirmation value does not appear to match the expected value'); |
|
| 54 | + } |
|
| 55 | + |
|
| 56 | + try { |
|
| 57 | + $request->save(); |
|
| 58 | + } |
|
| 59 | + catch (OptimisticLockFailedException $ex) { |
|
| 60 | + // Okay. Someone's edited this in the time between us loading this page and doing the checks, and us getting |
|
| 61 | + // to saving the page. We *do not* want to show an optimistic lock failure, the most likely problem is they |
|
| 62 | + // double-loaded this page (see #255). Let's confirm this, and bomb out with a success message if it's the |
|
| 63 | + // case. |
|
| 64 | + |
|
| 65 | + $request = Request::getById($id, $this->getDatabase()); |
|
| 66 | + if ($request->getEmailConfirm() === 'Confirmed') { |
|
| 67 | + // we've already done the sanity checks above |
|
| 68 | + |
|
| 69 | + $this->redirect('requestSubmitted'); |
|
| 70 | + |
|
| 71 | + // skip the log and notification |
|
| 72 | + return; |
|
| 73 | + } |
|
| 74 | + |
|
| 75 | + // something really weird happened. Another race condition? |
|
| 76 | + throw $ex; |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + Logger::emailConfirmed($this->getDatabase(), $request); |
|
| 80 | + $this->getNotificationHelper()->requestReceived($request); |
|
| 81 | + |
|
| 82 | + $this->redirect('requestSubmitted'); |
|
| 83 | + } |
|
| 84 | 84 | } |
| 85 | 85 | \ No newline at end of file |
@@ -12,12 +12,12 @@ |
||
| 12 | 12 | |
| 13 | 13 | class PageRequestSubmitted extends PublicInterfacePageBase |
| 14 | 14 | { |
| 15 | - /** |
|
| 16 | - * Main function for this page, when no specific actions are called. |
|
| 17 | - * @return void |
|
| 18 | - */ |
|
| 19 | - protected function main() |
|
| 20 | - { |
|
| 21 | - $this->setTemplate('request/email-confirmed.tpl'); |
|
| 22 | - } |
|
| 15 | + /** |
|
| 16 | + * Main function for this page, when no specific actions are called. |
|
| 17 | + * @return void |
|
| 18 | + */ |
|
| 19 | + protected function main() |
|
| 20 | + { |
|
| 21 | + $this->setTemplate('request/email-confirmed.tpl'); |
|
| 22 | + } |
|
| 23 | 23 | } |
| 24 | 24 | \ No newline at end of file |
@@ -17,43 +17,43 @@ |
||
| 17 | 17 | |
| 18 | 18 | class PageSendToUser extends RequestActionBase |
| 19 | 19 | { |
| 20 | - /** |
|
| 21 | - * Main function for this page, when no specific actions are called. |
|
| 22 | - * @throws ApplicationLogicException |
|
| 23 | - * @throws Exception |
|
| 24 | - */ |
|
| 25 | - protected function main() |
|
| 26 | - { |
|
| 27 | - $this->checkPosted(); |
|
| 28 | - $database = $this->getDatabase(); |
|
| 29 | - $request = $this->getRequest($database); |
|
| 30 | - |
|
| 31 | - if ($request->getReserved() !== User::getCurrent($database)->getId()) { |
|
| 32 | - throw new ApplicationLogicException('You don\'t have this request reserved!'); |
|
| 33 | - } |
|
| 34 | - |
|
| 35 | - $username = WebRequest::postString('user'); |
|
| 36 | - if ($username === null) { |
|
| 37 | - throw new ApplicationLogicException('User must be specified'); |
|
| 38 | - } |
|
| 39 | - |
|
| 40 | - $user = User::getByUsername($username, $database); |
|
| 41 | - if ($user === false) { |
|
| 42 | - throw new ApplicationLogicException('User not found'); |
|
| 43 | - } |
|
| 44 | - |
|
| 45 | - if (!$user->isActive()) { |
|
| 46 | - throw new ApplicationLogicException('User is currently not active on the tool'); |
|
| 47 | - } |
|
| 48 | - |
|
| 49 | - $request->setReserved($user->getId()); |
|
| 50 | - $request->setUpdateVersion(WebRequest::postInt('updateversion')); |
|
| 51 | - $request->save(); |
|
| 52 | - |
|
| 53 | - Logger::sendReservation($database, $request, $user); |
|
| 54 | - $this->getNotificationHelper()->requestReservationSent($request, $user); |
|
| 55 | - SessionAlert::success("Reservation sent successfully"); |
|
| 56 | - |
|
| 57 | - $this->redirect('viewRequest', null, array('id' => $request->getId())); |
|
| 58 | - } |
|
| 20 | + /** |
|
| 21 | + * Main function for this page, when no specific actions are called. |
|
| 22 | + * @throws ApplicationLogicException |
|
| 23 | + * @throws Exception |
|
| 24 | + */ |
|
| 25 | + protected function main() |
|
| 26 | + { |
|
| 27 | + $this->checkPosted(); |
|
| 28 | + $database = $this->getDatabase(); |
|
| 29 | + $request = $this->getRequest($database); |
|
| 30 | + |
|
| 31 | + if ($request->getReserved() !== User::getCurrent($database)->getId()) { |
|
| 32 | + throw new ApplicationLogicException('You don\'t have this request reserved!'); |
|
| 33 | + } |
|
| 34 | + |
|
| 35 | + $username = WebRequest::postString('user'); |
|
| 36 | + if ($username === null) { |
|
| 37 | + throw new ApplicationLogicException('User must be specified'); |
|
| 38 | + } |
|
| 39 | + |
|
| 40 | + $user = User::getByUsername($username, $database); |
|
| 41 | + if ($user === false) { |
|
| 42 | + throw new ApplicationLogicException('User not found'); |
|
| 43 | + } |
|
| 44 | + |
|
| 45 | + if (!$user->isActive()) { |
|
| 46 | + throw new ApplicationLogicException('User is currently not active on the tool'); |
|
| 47 | + } |
|
| 48 | + |
|
| 49 | + $request->setReserved($user->getId()); |
|
| 50 | + $request->setUpdateVersion(WebRequest::postInt('updateversion')); |
|
| 51 | + $request->save(); |
|
| 52 | + |
|
| 53 | + Logger::sendReservation($database, $request, $user); |
|
| 54 | + $this->getNotificationHelper()->requestReservationSent($request, $user); |
|
| 55 | + SessionAlert::success("Reservation sent successfully"); |
|
| 56 | + |
|
| 57 | + $this->redirect('viewRequest', null, array('id' => $request->getId())); |
|
| 58 | + } |
|
| 59 | 59 | } |
@@ -17,58 +17,58 @@ |
||
| 17 | 17 | |
| 18 | 18 | class PageReservation extends RequestActionBase |
| 19 | 19 | { |
| 20 | - /** |
|
| 21 | - * Main function for this page, when no specific actions are called. |
|
| 22 | - * @throws ApplicationLogicException |
|
| 23 | - */ |
|
| 24 | - protected function main() |
|
| 25 | - { |
|
| 26 | - $this->checkPosted(); |
|
| 27 | - $database = $this->getDatabase(); |
|
| 28 | - $request = $this->getRequest($database); |
|
| 20 | + /** |
|
| 21 | + * Main function for this page, when no specific actions are called. |
|
| 22 | + * @throws ApplicationLogicException |
|
| 23 | + */ |
|
| 24 | + protected function main() |
|
| 25 | + { |
|
| 26 | + $this->checkPosted(); |
|
| 27 | + $database = $this->getDatabase(); |
|
| 28 | + $request = $this->getRequest($database); |
|
| 29 | 29 | |
| 30 | - $closureDate = $request->getClosureDate(); |
|
| 30 | + $closureDate = $request->getClosureDate(); |
|
| 31 | 31 | |
| 32 | - $date = new DateTime(); |
|
| 33 | - $date->modify("-7 days"); |
|
| 34 | - $oneweek = $date->format("Y-m-d H:i:s"); |
|
| 32 | + $date = new DateTime(); |
|
| 33 | + $date->modify("-7 days"); |
|
| 34 | + $oneweek = $date->format("Y-m-d H:i:s"); |
|
| 35 | 35 | |
| 36 | - $currentUser = User::getCurrent($database); |
|
| 37 | - if ($request->getStatus() == "Closed" && $closureDate < $oneweek) { |
|
| 38 | - if (!$this->barrierTest('reopenOldRequest', $currentUser, 'RequestData')) { |
|
| 39 | - throw new ApplicationLogicException( |
|
| 40 | - "You are not allowed to reserve a request that has been closed for over a week."); |
|
| 41 | - } |
|
| 42 | - } |
|
| 36 | + $currentUser = User::getCurrent($database); |
|
| 37 | + if ($request->getStatus() == "Closed" && $closureDate < $oneweek) { |
|
| 38 | + if (!$this->barrierTest('reopenOldRequest', $currentUser, 'RequestData')) { |
|
| 39 | + throw new ApplicationLogicException( |
|
| 40 | + "You are not allowed to reserve a request that has been closed for over a week."); |
|
| 41 | + } |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - if ($request->getReserved() !== null && $request->getReserved() != $currentUser->getId()) { |
|
| 45 | - throw new ApplicationLogicException("Request is already reserved!"); |
|
| 46 | - } |
|
| 44 | + if ($request->getReserved() !== null && $request->getReserved() != $currentUser->getId()) { |
|
| 45 | + throw new ApplicationLogicException("Request is already reserved!"); |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - if ($request->getReserved() === null) { |
|
| 49 | - // Check the number of requests a user has reserved already |
|
| 50 | - $doubleReserveCountQuery = $database->prepare("SELECT COUNT(*) FROM request WHERE reserved = :userid;"); |
|
| 51 | - $doubleReserveCountQuery->bindValue(":userid", $currentUser->getId()); |
|
| 52 | - $doubleReserveCountQuery->execute(); |
|
| 53 | - $doubleReserveCount = $doubleReserveCountQuery->fetchColumn(); |
|
| 54 | - $doubleReserveCountQuery->closeCursor(); |
|
| 48 | + if ($request->getReserved() === null) { |
|
| 49 | + // Check the number of requests a user has reserved already |
|
| 50 | + $doubleReserveCountQuery = $database->prepare("SELECT COUNT(*) FROM request WHERE reserved = :userid;"); |
|
| 51 | + $doubleReserveCountQuery->bindValue(":userid", $currentUser->getId()); |
|
| 52 | + $doubleReserveCountQuery->execute(); |
|
| 53 | + $doubleReserveCount = $doubleReserveCountQuery->fetchColumn(); |
|
| 54 | + $doubleReserveCountQuery->closeCursor(); |
|
| 55 | 55 | |
| 56 | - // User already has at least one reserved. |
|
| 57 | - if ($doubleReserveCount != 0) { |
|
| 58 | - SessionAlert::warning("You have multiple requests reserved!"); |
|
| 59 | - } |
|
| 56 | + // User already has at least one reserved. |
|
| 57 | + if ($doubleReserveCount != 0) { |
|
| 58 | + SessionAlert::warning("You have multiple requests reserved!"); |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - $request->setReserved($currentUser->getId()); |
|
| 62 | - $request->setUpdateVersion(WebRequest::postInt('updateversion')); |
|
| 63 | - $request->save(); |
|
| 61 | + $request->setReserved($currentUser->getId()); |
|
| 62 | + $request->setUpdateVersion(WebRequest::postInt('updateversion')); |
|
| 63 | + $request->save(); |
|
| 64 | 64 | |
| 65 | - Logger::reserve($database, $request); |
|
| 65 | + Logger::reserve($database, $request); |
|
| 66 | 66 | |
| 67 | - $this->getNotificationHelper()->requestReserved($request); |
|
| 67 | + $this->getNotificationHelper()->requestReserved($request); |
|
| 68 | 68 | |
| 69 | - SessionAlert::success("Reserved request {$request->getId()}."); |
|
| 70 | - } |
|
| 69 | + SessionAlert::success("Reserved request {$request->getId()}."); |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - $this->redirect('viewRequest', null, array('id' => $request->getId())); |
|
| 73 | - } |
|
| 72 | + $this->redirect('viewRequest', null, array('id' => $request->getId())); |
|
| 73 | + } |
|
| 74 | 74 | } |
@@ -18,9 +18,9 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | interface IRequestRouter |
| 20 | 20 | { |
| 21 | - /** |
|
| 22 | - * @return IRoutedTask |
|
| 23 | - * @throws Exception |
|
| 24 | - */ |
|
| 25 | - public function route(); |
|
| 21 | + /** |
|
| 22 | + * @return IRoutedTask |
|
| 23 | + * @throws Exception |
|
| 24 | + */ |
|
| 25 | + public function route(); |
|
| 26 | 26 | } |
| 27 | 27 | \ No newline at end of file |
@@ -15,42 +15,42 @@ |
||
| 15 | 15 | |
| 16 | 16 | class PublicRequestRouter extends RequestRouter |
| 17 | 17 | { |
| 18 | - /** |
|
| 19 | - * Gets the route map to be used by this request router. |
|
| 20 | - * |
|
| 21 | - * @return array |
|
| 22 | - */ |
|
| 23 | - protected function getRouteMap() |
|
| 24 | - { |
|
| 25 | - return array( |
|
| 26 | - // Page showing a message stating the request has been submitted to our internal queues |
|
| 27 | - 'requestSubmitted' => |
|
| 28 | - array( |
|
| 29 | - 'class' => PageRequestSubmitted::class, |
|
| 30 | - 'actions' => array(), |
|
| 31 | - ), |
|
| 32 | - // Page showing a message stating that email confirmation is required to continue |
|
| 33 | - 'emailConfirmationRequired' => |
|
| 34 | - array( |
|
| 35 | - 'class' => PageEmailConfirmationRequired::class, |
|
| 36 | - 'actions' => array(), |
|
| 37 | - ), |
|
| 38 | - // Action page which handles email confirmation |
|
| 39 | - 'confirmEmail' => |
|
| 40 | - array( |
|
| 41 | - 'class' => PageConfirmEmail::class, |
|
| 42 | - 'actions' => array(), |
|
| 43 | - ), |
|
| 44 | - ); |
|
| 45 | - } |
|
| 18 | + /** |
|
| 19 | + * Gets the route map to be used by this request router. |
|
| 20 | + * |
|
| 21 | + * @return array |
|
| 22 | + */ |
|
| 23 | + protected function getRouteMap() |
|
| 24 | + { |
|
| 25 | + return array( |
|
| 26 | + // Page showing a message stating the request has been submitted to our internal queues |
|
| 27 | + 'requestSubmitted' => |
|
| 28 | + array( |
|
| 29 | + 'class' => PageRequestSubmitted::class, |
|
| 30 | + 'actions' => array(), |
|
| 31 | + ), |
|
| 32 | + // Page showing a message stating that email confirmation is required to continue |
|
| 33 | + 'emailConfirmationRequired' => |
|
| 34 | + array( |
|
| 35 | + 'class' => PageEmailConfirmationRequired::class, |
|
| 36 | + 'actions' => array(), |
|
| 37 | + ), |
|
| 38 | + // Action page which handles email confirmation |
|
| 39 | + 'confirmEmail' => |
|
| 40 | + array( |
|
| 41 | + 'class' => PageConfirmEmail::class, |
|
| 42 | + 'actions' => array(), |
|
| 43 | + ), |
|
| 44 | + ); |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * Gets the default route if no explicit route is requested. |
|
| 49 | - * |
|
| 50 | - * @return callable |
|
| 51 | - */ |
|
| 52 | - protected function getDefaultRoute() |
|
| 53 | - { |
|
| 54 | - return array(PageRequestAccount::class, 'main'); |
|
| 55 | - } |
|
| 47 | + /** |
|
| 48 | + * Gets the default route if no explicit route is requested. |
|
| 49 | + * |
|
| 50 | + * @return callable |
|
| 51 | + */ |
|
| 52 | + protected function getDefaultRoute() |
|
| 53 | + { |
|
| 54 | + return array(PageRequestAccount::class, 'main'); |
|
| 55 | + } |
|
| 56 | 56 | } |
| 57 | 57 | \ No newline at end of file |
@@ -7,46 +7,46 @@ |
||
| 7 | 7 | ******************************************************************************/ |
| 8 | 8 | |
| 9 | 9 | $toolList = array( |
| 10 | - 'tparis-pcount' => '//tools.wmflabs.org/supercount/index.php?user=%DATA%&project=en.wikipedia', |
|
| 11 | - 'guc' => '//tools.wmflabs.org/guc/?by=date&user=%DATA%', |
|
| 12 | - 'oq-whois' => 'https://whois.domaintools.com/%DATA%', |
|
| 13 | - 'tl-whois' => 'https://tools.wmflabs.org/whois/gateway.py?lookup=true&ip=%DATA%', |
|
| 14 | - 'honeypot' => 'https://www.projecthoneypot.org/ip_%DATA%', |
|
| 15 | - 'stopforumspam' => 'https://www.stopforumspam.com/ipcheck/%DATA%', |
|
| 16 | - 'google' => 'https://www.google.com/search?q=%DATA%', |
|
| 17 | - 'domain' => 'http://%DATA%/', |
|
| 18 | - 'rangefinder' => 'https://tools.wmflabs.org/rangeblockfinder/?ip=%DATA%', |
|
| 10 | + 'tparis-pcount' => '//tools.wmflabs.org/supercount/index.php?user=%DATA%&project=en.wikipedia', |
|
| 11 | + 'guc' => '//tools.wmflabs.org/guc/?by=date&user=%DATA%', |
|
| 12 | + 'oq-whois' => 'https://whois.domaintools.com/%DATA%', |
|
| 13 | + 'tl-whois' => 'https://tools.wmflabs.org/whois/gateway.py?lookup=true&ip=%DATA%', |
|
| 14 | + 'honeypot' => 'https://www.projecthoneypot.org/ip_%DATA%', |
|
| 15 | + 'stopforumspam' => 'https://www.stopforumspam.com/ipcheck/%DATA%', |
|
| 16 | + 'google' => 'https://www.google.com/search?q=%DATA%', |
|
| 17 | + 'domain' => 'http://%DATA%/', |
|
| 18 | + 'rangefinder' => 'https://tools.wmflabs.org/rangeblockfinder/?ip=%DATA%', |
|
| 19 | 19 | 'ipcheck' => 'https://ipcheck.toolforge.org/index.php?ip=%DATA%', |
| 20 | 20 | 'bgpview' => 'https://bgpview.io/ip/%DATA%' |
| 21 | 21 | ); |
| 22 | 22 | |
| 23 | 23 | if (!isset($_GET['tool']) |
| 24 | - || !isset($toolList[$_GET['tool']]) |
|
| 25 | - || !isset($_GET['data']) |
|
| 24 | + || !isset($toolList[$_GET['tool']]) |
|
| 25 | + || !isset($_GET['data']) |
|
| 26 | 26 | ) { |
| 27 | - header("HTTP/1.1 403 Forbidden"); |
|
| 27 | + header("HTTP/1.1 403 Forbidden"); |
|
| 28 | 28 | |
| 29 | - return; |
|
| 29 | + return; |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | if (isset($_GET['round2'])) { |
| 33 | - $data = $_GET['data']; |
|
| 34 | - $tool = $_GET['tool']; |
|
| 33 | + $data = $_GET['data']; |
|
| 34 | + $tool = $_GET['tool']; |
|
| 35 | 35 | |
| 36 | - if ($tool === 'domain') { |
|
| 37 | - // quick security check - if you want to exploit something, you better be sure your exploit resolves via dns. |
|
| 38 | - // this is not intended to catch everything, just as a quick sanity check. |
|
| 39 | - if (gethostbyname($data) == $data) { |
|
| 40 | - echo 'Error resolving hostname, it doesn\'t look like this domain exists.'; |
|
| 41 | - die(); |
|
| 42 | - } |
|
| 43 | - } |
|
| 44 | - else { |
|
| 45 | - $data = urlencode($data); |
|
| 46 | - } |
|
| 36 | + if ($tool === 'domain') { |
|
| 37 | + // quick security check - if you want to exploit something, you better be sure your exploit resolves via dns. |
|
| 38 | + // this is not intended to catch everything, just as a quick sanity check. |
|
| 39 | + if (gethostbyname($data) == $data) { |
|
| 40 | + echo 'Error resolving hostname, it doesn\'t look like this domain exists.'; |
|
| 41 | + die(); |
|
| 42 | + } |
|
| 43 | + } |
|
| 44 | + else { |
|
| 45 | + $data = urlencode($data); |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - echo '<script>window.location.href=' . json_encode(str_replace("%DATA%", $data, $toolList[$tool])) . '</script>'; |
|
| 48 | + echo '<script>window.location.href=' . json_encode(str_replace("%DATA%", $data, $toolList[$tool])) . '</script>'; |
|
| 49 | 49 | } |
| 50 | 50 | else { |
| 51 | - header("Location: " . $_SERVER["REQUEST_URI"] . "&round2=true"); |
|
| 51 | + header("Location: " . $_SERVER["REQUEST_URI"] . "&round2=true"); |
|
| 52 | 52 | } |
@@ -13,17 +13,17 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | function smarty_modifier_iphex($input) |
| 15 | 15 | { |
| 16 | - $output = $input; |
|
| 16 | + $output = $input; |
|
| 17 | 17 | |
| 18 | - if (filter_var($input, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) !== false) { |
|
| 19 | - $octets = explode('.', $input); |
|
| 20 | - $output = ''; |
|
| 21 | - foreach ($octets as $octet) { |
|
| 22 | - $output .= str_pad(dechex($octet), 2, '0', STR_PAD_LEFT); |
|
| 23 | - } |
|
| 18 | + if (filter_var($input, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) !== false) { |
|
| 19 | + $octets = explode('.', $input); |
|
| 20 | + $output = ''; |
|
| 21 | + foreach ($octets as $octet) { |
|
| 22 | + $output .= str_pad(dechex($octet), 2, '0', STR_PAD_LEFT); |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - $output = str_pad($output, 32, '0', STR_PAD_LEFT); |
|
| 26 | - } |
|
| 25 | + $output = str_pad($output, 32, '0', STR_PAD_LEFT); |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | - return $output; |
|
| 28 | + return $output; |
|
| 29 | 29 | } |
@@ -14,9 +14,9 @@ |
||
| 14 | 14 | |
| 15 | 15 | function smarty_modifier_nlimplode($list, $conjunction = 'or') |
| 16 | 16 | { |
| 17 | - $last = array_pop($list); |
|
| 18 | - if ($list) { |
|
| 19 | - return implode(', ', $list) . ', ' . $conjunction . ' ' . $last; |
|
| 20 | - } |
|
| 21 | - return $last; |
|
| 17 | + $last = array_pop($list); |
|
| 18 | + if ($list) { |
|
| 19 | + return implode(', ', $list) . ', ' . $conjunction . ' ' . $last; |
|
| 20 | + } |
|
| 21 | + return $last; |
|
| 22 | 22 | } |
| 23 | 23 | \ No newline at end of file |