Skip to content

Instantly share code, notes, and snippets.

Shaked Klein Orbach Shaked

Block or report user

Report or block Shaked

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View remote.php
<?php
$url = $_GET['url'];
$xml = @file_get_contents($url);
$ret = [];
if ($xml) {
$doc = new DOMDocument();
libxml_use_internal_errors(true);
if ($doc->loadHTML($xml)) {
View README.md
$ lsb_release  -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.2 LTS
Release:	18.04
Codename:	bionic

$ dpkg -l | grep strongswan
ii  libstrongswan                       5.6.2-1ubuntu2.4                            amd64        strongSwan utility and crypto library
View Dockerfile1604
FROM arm64v8/ubuntu:16.04
RUN apt-get update && \
apt-get install -y software-properties-common vim && \
add-apt-repository ppa:jonathonf/python-3.6
RUN apt-get update -y
RUN apt-get install -y build-essential python3.6 python3.6-dev python3-pip python3.6-venv && \
apt-get install -y git
View Dockerfile
# docker build -t ubuntu1604py36
FROM ubuntu:18.04
RUN apt-get update && \
apt-get install -y software-properties-common vim && \
add-apt-repository ppa:jonathonf/python-3.6
RUN apt-get update -y
RUN apt-get install -y build-essential python3.6 python3.6-dev python3-pip python3.6-venv && \
apt-get install -y git
View example.php
<?php
..
..
$cmd = 'docker build someimage';
$process = Process::fromShellCommandline($cmd);
$process->setTimeout(0);
$process->run(function ($type, $buffer) {
if (Process::ERR === $type) {
echo 'ERR > '.$buffer;
View gist:90af6960ddb940d76b4a4e1117a00552

Using strace and lsof to debug blocked processes

You can use strace on a specific pid to figure out what a specific process is doing, e.g.:

strace -fp <pid>

You might see something like:

select(9, [3 5 8], [], [], {0, 999999})   = 0 (Timeout)
@Shaked
Shaked / Secure.php
Created Oct 15, 2018
PHP Security Question - Is This Secure?
View Secure.php
<?php
$userRequest = $_GET['userRequest'] ?? null;
$path = 'file' . $userRequest;
if (file_exists($path)) {
require_once($path);
} else {
echo 'File does not exist';
}
View IsThisSecure.php
<?php
class A {
/**
* @param $args
*/
public function methodIsCool($args) {
var_dump($args);
}
View ExceptionListener.php
<?php
namespace App;
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
use Psr\Log\LoggerInterface;
class ExceptionListener {
@Shaked
Shaked / IndexController.php
Last active Aug 3, 2018
Symfony error example
View IndexController.php
<?php
namespace App\Controller;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Psr\Log\LoggerInterface;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
You can’t perform that action at this time.