Skip to content

Instantly share code, notes, and snippets.

View narbehaj's full-sized avatar
🏠
Working from home

Narbeh narbehaj

🏠
Working from home
View GitHub Profile

Keybase proof

I hereby claim:

  • I am narbehaj on github.
  • I am narbehaj (https://keybase.io/narbehaj) on keybase.
  • I have a public key ASAr51tdbhigfadz3DSGd42O4fK7myEGKtcqmz5A_i0CKwo

To claim this, I am signing this object:

@narbehaj
narbehaj / find_duplicates.py
Last active May 28, 2018 23:54
Finds duplicate files under the directory
import hashlib
import os
m_list = []
for i, d , e in os.walk('/home/test/'):
for file in e:
if file.endswith('mkv'):
with open('{}/{}'.format(i, file), 'rb') as file_read:
for chunk in iter(lambda: file_read.read(4096), b""):
@narbehaj
narbehaj / filter_check.py
Created May 15, 2018 09:34
Checks host.txt file per line to see if the host is filtered in Iran or not.
import socket
file_name = 'hosts.txt'
def read_hosts(file):
hosts = []
with open(file, 'r') as f:
for host in f.readlines():
@narbehaj
narbehaj / gnupg.py
Created January 24, 2018 07:03
Encrypt files using Python GnuPG
###########################
# pip3 install python-gnupg
###########################
import os
from gnupg import GPG
# If using Debian/Ubuntu, it should be under
# /home/USERNAME/.gnupg otherwise check manually
@narbehaj
narbehaj / python-scapy-http.py
Last active June 16, 2022 08:12
Python scapy to sniff HTTP
from scapy.all import *
def packet_callback(packet):
if packet[TCP].payload:
if packet[IP].dport == 80:
print("\n{} ----HTTP----> {}:{}:\n{}".format(packet[IP].src,
packet[IP].dst,
packet[IP].dport,
str(bytes(packet[TCP].payload))))
@narbehaj
narbehaj / python_bruteforce.py
Last active October 16, 2017 08:19
Simple Python Bruteforce
from hashlib import md5
import random
from itertools import chain, product
def bruteforce(charset, maxlength):
return (''.join(candidate)
for candidate in chain.from_iterable(product(charset, repeat=i)
for i in range(2, maxlength + 1)))
@narbehaj
narbehaj / create-client.sh
Last active November 21, 2017 11:37
OpenVPN Server Configuration for GNU/Linux Servers
#!/bin/bash
source /etc/openvpn/easy-rsa/vars
client=$1
/etc/openvpn/easy-rsa/build-key $client
mkdir -p /tmp/tmp-vpn-client/$client
cp /etc/openvpn/easy-rsa/keys/$client.* /tmp/tmp-vpn-client/$client/
cp /etc/openvpn/easy-rsa/keys/ca.crt /tmp/tmp-vpn-client/$client/