Skip to content

Instantly share code, notes, and snippets.

View fffaraz's full-sized avatar
🚀
Focusing

Faraz Fallahi fffaraz

🚀
Focusing
View GitHub Profile
#include<stdio.h>
#include<stdlib.h>
#include<sys/socket.h>
#include<features.h>
#include<linux/if_packet.h>
#include<linux/if_ether.h>
#include<errno.h>
#include<sys/ioctl.h>
#include<net/if.h>
#include<net/ethernet.h>
@fffaraz
fffaraz / tr4_ll.c
Created November 12, 2015 02:59
TCP/ICMP/UDP traceroute
/* Copyright (C) 2012-2015 P.D. Buchan (pdbuchan@yahoo.com)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@fffaraz
fffaraz / bs4.py
Created November 25, 2016 20:21
Python YouTube Playlist Link Collector
from bs4 import BeautifulSoup
import requests
def getPlaylistLinks(url):
sourceCode = requests.get(url).text
soup = BeautifulSoup(sourceCode, 'html.parser')
domain = 'https://www.youtube.com'
for link in soup.find_all("a", {"dir": "ltr"}):
href = link.get('href')
if href.startswith('/watch?'):
@fffaraz
fffaraz / bomb.php
Created July 5, 2017 20:41
How to defend your website with ZIP bombs
<?php
// https://blog.haschek.at/2017/how-to-defend-your-website-with-zip-bombs.html
// dd if=/dev/zero bs=1M count=10240 | gzip > 10G.gzip
$agent = lower($_SERVER['HTTP_USER_AGENT']);
//check for nikto, sql map or "bad" subfolders which only exist on wordpress
if (strpos($agent, 'nikto') !== false || strpos($agent, 'sqlmap') !== false || startswith($url,'wp-') || startswith($url,'wordpress') || startswith($url,'wp/'))
{
sendBomb();
@fffaraz
fffaraz / pull.bat
Last active December 23, 2022 18:54
git pull
@echo off
for /d %%D in (*) do (
cd %%D
echo %%D
git pull
cd..
)
@fffaraz
fffaraz / apache.md
Created December 21, 2014 23:31
Apache Cheat Sheet

Source

Apache Cheat Sheet

Setup a Virtual Domain

NameVirtualHost *

DocumentRoot /web/example.com/www

@fffaraz
fffaraz / math_unsigned.h
Created October 13, 2015 04:48
Arbitrary-precision integer arithmetic in C++
#ifndef MATH_UNSIGNED_H
#define MATH_UNSIGNED_H
#include <cstdint>
#include <vector>
#include <iostream>
#include <stdexcept>
#include <algorithm>
#include <sstream>
#include <cctype>
@fffaraz
fffaraz / gcd_prob.cpp
Created June 6, 2021 04:30
gcd_prob.cpp
#include <iostream>
#include <random>
#include <bits/stdc++.h>
using namespace std;
int main()
{
std::random_device m_device{};
std::mt19937 m_generator{m_device()};
@fffaraz
fffaraz / telegram_emojis.cpp
Created June 6, 2021 04:26
telegram_emojis.cpp
#include <QCoreApplication>
#include <QFile>
#include <QDataStream>
#include <QDebug>
#include <iostream>
namespace Ui {
namespace Emoji {
constexpr auto kPostfix = 0xFE0FU;
class One {};
@fffaraz
fffaraz / exec.md
Last active March 1, 2021 12:23
execl, execlp, execle, execv, execvp, execvpe
- e p
l execl execle execlp
v execv execve execvp

  • int execl(char const *path, char const *arg0, ...);
  • int execle(char const *path, char const *arg0, ..., char const *envp[]);