Skip to content

Instantly share code, notes, and snippets.

View alibo's full-sized avatar
💭
🤦‍♂️

Ali Borhani alibo

💭
🤦‍♂️
View GitHub Profile
@alibo
alibo / zip_server.js
Last active January 24, 2023 11:59
Generating & Downloading zip folder on the fly (dynamically) using Node.JS
//@see https://www.npmjs.com/package/archiver
var archiver = require('archiver')
var http = require('http');
http.createServer(function(request, response) {
var archiver = archiver('zip')
archiver.pipe(response)
response.setHeader('Content-type', 'application/zip')
response.setHeader('Content-disposition', 'attachment; filename=file_name.zip');
@alibo
alibo / ValidatorServiceProvider.php
Last active August 29, 2015 14:22
'not_exists' rule for validator in laravel 5.0+ [Simple Solution!]
<?php namespace App\Providers;
use Illuminate\Validation\Factory as Validator;
use Illuminate\Support\ServiceProvider;
class ValidatorServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application services.
@alibo
alibo / filtering_bug.php
Last active August 29, 2015 14:23
A bug in filtering system of Iran (#filternet) - Proof Of Concept script [more info (in Persian): http://shirazi.blogfa.com/post/388]
<?php
/**
* There is a bug in filternet. If you connect to yahoo.com:80
* and type `GET / HTTP/1.1\r\nHost: msn.com\r\n\r\n` you can see msn.com page!
*
*
* How to run:
* $ php filtering_bug.php <domain-address> <http-host-value>
*
* - <domain-address> : connecting via tcp
@alibo
alibo / filternet_bypass_bug.php
Last active August 29, 2015 14:23
Bypass filternet! (a bug in filtering system of Iran) - Proof of Concept
<?php
/**
* There is a bug in filternet (filtering system of Iran).
* if you wait 2 seconds or more
* before sending http request headers, you can bypass
* filternet! Also you should use LF
* instead of CRLF (like netcat).
*
*
* How to run:
@alibo
alibo / filternet_bypass_bug.js
Last active August 29, 2015 14:23
Bypass filternet (Node.js version!) [PHP version: https://gist.github.com/alibo/22ed0cf12d8398703335]
/**
* There is a bug in filternet (filtering system of Iran).
* if you wait 3 seconds or more
* before sending http request headers, you can bypass
* filternet! Also you should use LF
* instead of CRLF (like netcat).
*
*
* How to run:
* $ node filternet_bypass_bug.js <domain-address> <http-host-value> <wait-time> <path>
@alibo
alibo / answer-possibility.php
Created October 22, 2015 10:02
Calculate the possibility of minimum correct answers in single-choice questions with 4 choices (by just guessing!)
<?php
bcscale(70);
function factorial($number){
$factorial = 1;
while($number > 0){
$factorial = bcmul($factorial, $number);
@alibo
alibo / make_alias.sh
Created December 9, 2015 18:55
A simple bash function for making an alias of current directory
make_alias ()
{
echo "alias $1=\"cd `pwd`\"" >> ~/.bash_profile
source ~/.bash_profile
}
@alibo
alibo / dns-server.js
Last active February 13, 2016 20:00
Bypass DNS hijacking in Iran - [Proof of Concept]
'use strict';
// Proxy-Dns: https://www.npmjs.com/package/proxy-dns
let ProxyDNS = require('proxy-dns').default;
const dns = new ProxyDNS({
ttl: 600
});
dns.use(function* (next) {
@alibo
alibo / OpenshiftThrottleRequests.php
Created February 14, 2016 19:17
A simple solution for using Laravel's rate-limiting on openshift.com
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Routing\Middleware\ThrottleRequests;
class OpenshiftThrottleRequests extends ThrottleRequests
{
/**
@alibo
alibo / filternet-14-03-2016-top6-5k.csv
Last active March 17, 2016 10:56
State of Alexa Top 6.5K global sites in Iran [Censorship]
Rank Site SNI HTTP DNS
1 google.com open open open
2 facebook.com blocked blocked blocked
3 youtube.com blocked blocked blocked
4 baidu.com open open open
5 yahoo.com open open open
6 amazon.com open open open
7 wikipedia.org open open open
8 qq.com open open open
9 google.co.in open open open