Skip to content

Instantly share code, notes, and snippets.

View fffaraz's full-sized avatar
🚀
Focusing

Faraz Fallahi fffaraz

🚀
Focusing
View GitHub Profile
@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 / portscanner.c
Last active July 31, 2024 17:57
Port scanner code in c
#include "stdio.h"
#include "sys/socket.h"
#include "errno.h"
#include "netdb.h"
#include "string.h"
#include "stdlib.h"
int main(int argc , char **argv)
{
struct hostent *host;
@fffaraz
fffaraz / tcpserver.go
Created July 22, 2016 20:40
go tcp server
package main
import (
"io"
"log"
"net"
"os"
"runtime"
)
@fffaraz
fffaraz / dns.c
Created May 29, 2016 05:58
DNS Query Code in C with linux sockets
//DNS Query Program on Linux
//Author : Silver Moon (m00n.silv3r@gmail.com)
//Dated : 29/4/2009
//Header Files
#include<stdio.h> //printf
#include<string.h> //strlen
#include<stdlib.h> //malloc
#include<sys/socket.h> //you know what this is for
#include<arpa/inet.h> //inet_addr , inet_ntoa , ntohs etc
@fffaraz
fffaraz / daemon.txt
Created April 16, 2016 20:14
daemon basics
// http://www.crankyotaku.com/2016/04/linux-programming-daemon-basics.html
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
@fffaraz
fffaraz / git-streak.sh
Created April 2, 2016 00:18
git-streak.sh
#!/bin/bash
current="Thu Dec 25 00:00:00 2014"
counter=9126
while [ $counter -le 9140 ]; do
export GIT_AUTHOR_DATE="$current +0000"
export GIT_COMMITTER_DATE=$GIT_AUTHOR_DATE
git commit --allow-empty -m "$counter"
@fffaraz
fffaraz / doping.sh
Created February 19, 2016 20:27
doping
#!/bin/bash
ping -c5 speedtest-nyc1.digitalocean.com
ping -c5 speedtest-nyc2.digitalocean.com
ping -c5 speedtest-nyc3.digitalocean.com
ping -c5 speedtest-ams1.digitalocean.com
ping -c5 speedtest-ams2.digitalocean.com
ping -c5 speedtest-ams3.digitalocean.com
ping -c5 speedtest-sfo1.digitalocean.com
ping -c5 speedtest-sgp1.digitalocean.com
ping -c5 speedtest-lon1.digitalocean.com
@fffaraz
fffaraz / lsniffer.c
Last active February 12, 2023 11:42
Packet Sniffer Code in C using Linux Sockets | http://www.binarytides.com/packet-sniffer-code-c-linux/
/*
Packet sniffer using libpcap library
*/
#include<pcap.h>
#include<stdio.h>
#include<stdlib.h> // for exit()
#include<string.h> //for memset
#include<sys/socket.h>
#include<arpa/inet.h> // for inet_ntoa()
#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