Skip to content

Instantly share code, notes, and snippets.

@fahadysf
fahadysf / taskdaemon-py3.py
Last active February 26, 2017 20:13
A multiprocess task broker which acts as: an example of Multiprocess asynchronous tasks which update a shared dictionary provided by multiprocess.Manager.
#!/usr/bin/python
from multiprocessing import Pool, Manager
from http.server import BaseHTTPRequestHandler, HTTPServer
import json
import cgi
import random, time
# Resources to read
#
#!/usr/bin/python
from multiprocessing import Pool, Manager
from http.server import BaseHTTPRequestHandler, HTTPServer
import urllib.request
import json
import cgi
import random, time
# Resources to read
@fahadysf
fahadysf / igate-style.css
Last active April 12, 2017 12:50
Stylish (Google Chrome Extension) Style for iGate
@font-face {
font-family: "STC-Regular";
}
* {
font-family: 'Calibri' !important;
font-size: 14px;
}
.ui-widget input,
.ui-widget select,
.ui-widget textarea,
@fahadysf
fahadysf / goget.go
Created November 6, 2017 04:12
Multi-threaded HTTP downloader in Go
package main
import (
"crypto/md5"
"encoding/hex"
"flag"
"fmt"
"io"
"net/http"
"os"

Keybase proof

I hereby claim:

  • I am fahadysf on github.

  • I am fahadysf (https://keybase.io/fahadysf) on keybase.

  • I have a public key ASDkblr_kBLbw68SVDakAelHy2qLLpPcj6IYO7IpbdDg2Qo

@fahadysf
fahadysf / custom-appid.py
Last active September 18, 2018 19:58
Find strings for APP-ID from PCAP files
#!/usr/local/bin/python2.7
"""
Copyright (C) 2018
Authors: Fahad Yousuf, Lorenzo Castelletti
This script parses a PCAP file and looks for common data patterns in TCP payloads.
These can then be used as signatures while building a custom App-ID.
It works for captures with multiple sessions of the same unknown-tcp traffic.
@fahadysf
fahadysf / pattern-extractor.py
Last active September 22, 2018 13:58
This script extracts TCP Flows from a Packet Capture files and finds common patterns (hex) of give length (default 7-bytes). Useful for Custom App-ID Creation
#!/usr/bin/env python
"""
Copyright (C) 2018
Author: Fahad Yousuf
This script extracts TCP Flows from a Packet Capture files and finds
common patterns (hex) of give length (default 7-bytes)
Usage: flowextractor.py [-h] [-d DPORT] inputfile
@fahadysf
fahadysf / check-temp.py
Last active April 25, 2020 01:43
Python 2 script to extract 'sensors' command temperature readings
#!/usr/bin/env python
"""
Script to create output of Physical Package CPU Temperature
using the sensors command. Handy for feeding to NetXMS with the below
Agent Config line
ExternalParameterShellExec=CPUTemperature(*): python /root/check-temp.py $1
"""
import sys
@fahadysf
fahadysf / create-ca-and-server-cert.sh
Created December 9, 2018 06:16
Script to create Self-Signed CA and Server Cert (using the CA)
#!/bin/bash
# Parameters for the Root CA Certificate (Self-Signed)
# Please Modify this according to your needs
CA_KEY_SIZE="4096"
# CA Certificate Subject Parameters
# Please Modify these according to your needs
C="SA"
ST="Riyadh"
O="Acme.com"
OU="PA"
@fahadysf
fahadysf / gist:951f904c092f8ff58691a5f7c0d23277
Last active June 30, 2022 06:41
Apple Macbook CLI Power Status
#!/bin/bash
CYCLE_COUNT=`system_profiler SPPowerDataType | grep "Cycle Count" | awk '{print $3}'`
MAX_CAPACYTY=`system_profiler SPPowerDataType | grep "Maximum Capacity" | awk '{print $3}'`
echo "Cycle Count: $CYCLE_COUNT"
echo "Maximum Capacity: $MAX_CAPACYTY"