Skip to content

Instantly share code, notes, and snippets.

View iamtalhaasghar's full-sized avatar
🇵🇰
Working From Home

Talha Asghar iamtalhaasghar

🇵🇰
Working From Home
View GitHub Profile
@boarpig
boarpig / gist:8118854
Created December 24, 2013 23:45
How to get plugin-container's cpu usage percent with python. This currently only handles one plugin container so your mileage may vary. You'll have to find your own cpu usage threshold if you actually want to use this to monitor if someone is actually watching a video or if it's just sitting still **further improvements:** You could use sh modul…
#!/usr/bin/python
#
# Based on answer from
# http://stackoverflow.com/questions/1420426/calculating-cpu-usage-of-a-process-in-linux
#
from time import sleep
import os
import os.path
import sys
@lekro
lekro / reminder.sh
Created April 15, 2018 02:39
Send discord webhook using curl
#!/bin/sh
WEBHOOK_URL="put your url here"
PING="<@put your user id here>"
MESSAGE="$PING reminder"
JSON="{\"content\": \"$MESSAGE\"}"
curl -d "$JSON" -H "Content-Type: application/json" "$WEBHOOK_URL"
@jeffhigham-f3
jeffhigham-f3 / mysqlbackup.sh
Last active February 24, 2024 17:07
Mysql Database Backup & Rotation Script
#!/bin/bash
## Author: Jeff Higham <jeff@f3code.com>, <jeffhigham@gmail.com>
## Gist: https://gist.github.com/jeffhigham-f3/3b94d508269e614f1f2e701ada8239cc
##
## Usage: mysqlbackup
##
## BEGIN EDITING
# timestamp for backups
@tobikris
tobikris / repair-dualboot-bootloader.sh
Last active April 14, 2024 22:47 — forked from Tamal/set-chroot.sh
Setting up chroot from a live image in Fedora. Regenerate grub2 for Fedora.
$ # Use Live CD to boot
$ sudo su # Switch to root
$ fdisk -l # Get names of root, boot & EFI partition names. you can also use blkid
$ # http://dadadom.de/2020/04/11/fix-fedora-uefi-boot-with-encrypted-partitions/
$ udiskctl unlock -b /dev/nvme0n1p6 # unlock root luks partition
$ mount /dev/mapper/fedora_fedora-root /mnt # mount root partition
$ mount /dev/mapper/fedora_fedora-var /mnt/var
$ mount /dev/nvme0n1p5 /mnt/boot # mount boot partition
@gmurdocca
gmurdocca / socat_caesar_dpi.md
Last active June 28, 2024 15:53
Circumventing Deep Packet Inspection with Socat and rot13

Circumventing Deep Packet Inspection with Socat and rot13

I have a Linux virtual machine inside a customer's private network. For security, this VM is reachable only via VPN + Citrix + Windows + a Windows SSH client (eg PuTTY). I am tasked to ensure this Citrix design is secure, and users can not access their Linux VM's or other resources on the internal private network in any way outside of using Citrix.

The VM can access the internet. This task should be easy. The VM's internet gateway allows it to connect anywhere on the internet to TCP ports 80, 443, and 8090 only. Connecting to an internet bastion box on one of these ports works and I can send and receive clear text data using netcat. I plan to use good old SSH, listening on tcp/8090 on the bastion, with a reverse port forward configured to expose sshd on the VM to the public, to show their Citrix gateway can be circumvented.

Rejected by Deep Packet Inspection

I hit an immediate snag. The moment I try to establish an SSH or SSL connection over o