Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Atef Ben Ali atefBB

🎯
Focusing
  • Tunis
View GitHub Profile
@atefBB
atefBB / tor_curl.php
Last active May 24, 2020 — forked from zachflower/tor_curl.php
How To Anonymize PHP cURL Requests Using Tor
View tor_curl.php
<?php
$ip = '127.0.0.1';
$port = '9051';
$auth = 'PASSWORD';
$command = 'signal NEWNYM';
$fp = fsockopen($ip,$port,$error_number,$err_string,10);
if(!$fp) {
echo "ERROR: $error_number : $err_string";
@atefBB
atefBB / response.php
Created Jul 31, 2018 — forked from luckyshot/response.php
Web scraping done right (with cUrl and user agent)
View response.php
<?php return array (
'url' => 'https://xaviesteve.com/',
'content_type' => 'text/html; charset=UTF-8',
'http_code' => 200,
'header_size' => 578,
'request_size' => 229,
'filetime' => -1,
'ssl_verify_result' => 0,
'redirect_count' => 0,
'total_time' => 0.27407799999999999,
@atefBB
atefBB / scrape.php
Created Jul 16, 2018 — forked from ziadoz/scrape.php
Scraping Google using PHP and Goutte:
View scrape.php
<?php
/**
* Todo: Send a random user agent string and sleep a random amount between requests.
*/
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// Extract and sanatize input:
$domain = filter_input(INPUT_POST, 'domain', FILTER_SANITIZE_URL);
$terms = filter_input(INPUT_POST, 'terms', FILTER_SANITIZE_STRING);
// Setup Goutte (which also includes Guzzle):
@atefBB
atefBB / PHP-CURL-Tor-Tutorial.md
Last active Sep 4, 2020 — forked from megaxorg/PHP-CURL-Tor-Tutorial.md
PHP: CURL Requests with Tor
View PHP-CURL-Tor-Tutorial.md

CURL Connections with Tor

Install Apache, PHP, CURL & Tor with apt-get

sudo apt-get install -y apache2 php5 php5-curl tor

Tor creates a proxy on your mashine with port 9050 for SOCKS5 connections.

@atefBB
atefBB / Validation.php
Last active May 10, 2018 — forked from JacobBennett/Validation.php
Laravel Custom Validation to check if the given value Exists as a Column in Table
View Validation.php
<?php
// BELIEVE THIS ONLY WORKS WHEN USING MYSQL
// DROP THIS INTO GLOBAL.PHP
Validator::extend('columnexists', function($attribute, $value, $parameters)
{
$query = DB::select("SHOW COLUMNS FROM " . $parameters[0]);
$columns = array();
@atefBB
atefBB / bootstrap.js
Last active Nov 16, 2017 — forked from davemo/bootstrap.js
injectorsauce
View bootstrap.js
(function() {
/**
* Bootstrap ng-app.
*/
var $injector = angular.injector(['ng']);
$injector.invoke(function($http) {
$http.get("/auth/csrf_token").then(function(response) {
angular.module("app").constant("CSRF_TOKEN", response.csrf_token);
angular.bootstrap(document, ['app']);
@atefBB
atefBB / MultiUserProvider.php
Last active Nov 15, 2017 — forked from Xethron/MultiUserProvider.php
Laravel 4 Authenticate Multiple User ProviderAllows Laravel Auth to login using multiple tables and/or databases/Eloquent User Models... Each User Model can have its own Hasher and Hasher options...
View MultiUserProvider.php
<?php
//app/libraries/MultiUserProvider.php
use Illuminate\Auth\UserProviderInterface,
Illuminate\Auth\UserInterface,
Illuminate\Auth\GenericUser;
class MultiUserProvider implements UserProviderInterface
{
/**
@atefBB
atefBB / back-to-top-directive.js
Last active Jun 5, 2017 — forked from sean-hill/AngularJS Back To Top Directive
AngularJS Back To Top Directive
View back-to-top-directive.js
// Back to top Directive
angular
.module('app.directives')
.directive('backToTop', function() {
return {
restrict: 'E',
replace: true,
template: '<div class="back-to-top"><i class="fa fa-chevron-up"></i></div>',
link: function($scope, element, attrs) {
@atefBB
atefBB / CronRunCommand.php
Last active Oct 12, 2017 — forked from sisou/CronRunCommand.php
Cron job command for Laravel 4.2
View CronRunCommand.php
<?php
# Cron job command for Laravel 4.2
# Inspired by Laravel 5's new upcoming scheduler (https://laravel-news.com/2014/11/laravel-5-scheduler)
#
# Author: Soren Schwert (GitHub: sisou)
# Author: Atef Ben Ali (gitHub: atefBB)
#
# Requirements:
# =============
@atefBB
atefBB / vanilla-js-cheatsheet.md
Created May 19, 2017 — forked from thegitfather/vanilla-js-cheatsheet.md
Vanilla JavaScript Quick Reference / Cheatsheet
View vanilla-js-cheatsheet.md
You can’t perform that action at this time.