Skip to content

Instantly share code, notes, and snippets.

@arush15june
arush15june / results.py
Created March 23, 2016 03:57
CBSE Class X School Result Parser
import re,operator
from math import sqrt
"""
THIS SCRIPT PARSES SCHOOL RESULT TXT FILES OBTAINED FROM CBSE'S
WEBSITE. IT EXTRACTS THE ROLLNO,NAME,CGPA AND MARKS(in a dictionary).
CHANGE THE SUBJECT STRINGS IN THE DICTS TO YOUR NEEDS.
"""
@arush15june
arush15june / sheet.py
Created September 16, 2016 18:38
Contact Sheet X
"""
Contact Sheet (Passport Size)
Pass the image filename(s) as argument to the script and a pdf
contact sheet will be made
by - arush15june
"""
import sys,PIL
from PIL import Image,ImageOps
@arush15june
arush15june / imgReduce.py
Created September 23, 2016 07:10
Image Reduce - Reduce Image sizes for crappy online forms
# Easy Image Size Reduction for Crappy
# Forms
# Input : imgReduce.py <file-name> <size to reduce to>
# by arush15june
import os,sys
from PIL import Image
file, size = sys.argv[1],sys.argv[2] # Image Path, Size (in KB)
@arush15june
arush15june / database.py
Last active April 28, 2018 02:58
cuckoo feeder
import os
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.ext.declarative import declarative_base
# Database
engine = None
if os.environ.get('DATABASE_URL') is not None:
engine = create_engine(os.environ.get('DATABASE_URL'), convert_unicode=True)
else:
@arush15june
arush15june / custom_thread.py
Created July 30, 2018 20:10
Thread Killer
class thread(threading.Thread):
""" Extended Thread to allow handling SIGINT """
def __init__(self):
self.alive = True
threading.Thread.__init__(self)
class threadedLoop(thread):
""" asyncio loop inside a thread """
def __init__(self, *args, **kwargs):
thread.__init__(self)
@arush15june
arush15june / bin_t.py
Created September 19, 2018 16:12
bin_t - CSAW CTF 2018 Quals
import random, math
from pwn import *
def random_data_generator (max_r):
for i in xrange(max_r):
yield random.randint(0, max_r)
class Node():
def __init__(self, key):
@arush15june
arush15june / data.csv
Last active September 27, 2018 05:30
Security Awareness Rating
methods heard knows college
eavesdropping 40 3 1
smshijacking 29 2 1
locationtracking 43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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@arush15june
arush15june / pcap_detect.py
Created August 7, 2020 09:04
Determine if a file is pcap or pcapng format
from binascii import unhexlify
PCAPNG_MAGIC = unhexlify('0a0d0d0a')
PCAP_MAGIC_BIG_ENDIAN_MICROSEND = unhexlify('a1b2c3d4')
PCAP_MAGIC_LITTLE_ENDIAN_MICROSECOND = unhexlify('d4c3b2a1')
PCAP_MAGIC_BIG_ENDIAN_NANOSECOND = unhexlify('a1b23c4d')
PCAP_MAGIC_LITTLE_ENDIAN_NANOSECOND = unhexlify('4d3cb2a1')
PACKET_CAPTURE_MAGICS = [
PCAPNG_MAGIC,
@arush15june
arush15june / crawl.py
Last active August 9, 2020 09:17
Crawl within directory for files conditionally with pathlib
import pathlib
from typing import Callable, List
def crawl_dirs_for_condition(root: pathlib.Path, file_item_condition: Callable) -> List[pathlib.Path]:
"""Crawl root dir for files,
path file path to file_item_condition function,
if file_item_condition(file_path) returns true,
append file path to files.
Returns