Skip to content

Instantly share code, notes, and snippets.

View kryptek's full-sized avatar

Alfred Moreno kryptek

  • Amazon Web Services
  • Seattle, WA
View GitHub Profile
kryptek /
Created December 10, 2023 20:53 — forked from Bilka2/
Simple discord webhook with python
import requests #dependency
url = "<your url>" #webhook url, from here:
#for all params, see
data = {
"content" : "message content",
"username" : "custom username"
kryptek /
Created June 28, 2023 08:27 — forked from inaz2/
Python implementation of traceroute
# references:
# Learning by doing: Writing your own traceroute in 8 easy steps (Ksplice Blog)
import sys
import socket
def traceroute(dest_addr, max_hops=30, timeout=0.2):
proto_icmp = socket.getprotobyname('icmp')
proto_udp = socket.getprotobyname('udp')
kryptek /
Created November 30, 2020 22:28 — forked from yunazuno/
ethtool -S in Python
#!/usr/bin/env python
import socket
import fcntl
import struct
import array
ETHTOOL_GSTATS = 0x0000001d
kryptek /
Created March 12, 2020 05:04 — forked from stefancocora/
Split tunneling with openconnect - A guide on how to use openconnect to establish a vpn connection to an enterprise cisco anyconnect vpn endpoint with client side routing.


The purpose of this short howto is to show you how to:

  • use openconnect [1] to connect to an enterprise cisco anyconnect endpoint
  • whilst minimizing the amount of traffic that your route through the vpn connection

Usually VPN administrators will puth the default route to the users, so that all user traffic is routed through the vpn connection. This is to address the various security concerns around compromised user computers bridging external internet traffic into the secure VPN network.

While the VPN administrator can push routes to the clients, the client can ignore these default routes and establish client side routing so that only the required A.B.C.D/E network is routed through the VPN. All other traffic will still use the clients default route and default outbound internet connection.

kryptek /
Created March 7, 2020 04:08 — forked from pawelszydlo/
Script to clear finished torrents from transmission-daemon
# port, username, password
SERVER="localhost:9091 --auth user:pass"
# use transmission-remote to get torrent list from transmission-remote list
TORRENTLIST=`transmission-remote $SERVER --list | sed -e '1d' -e '$d' | awk '{print $1}' | sed -e 's/[^0-9]*//g'`
# for each torrent in the list
kryptek /
Created February 11, 2017 21:28 — forked from kachayev/
Dijkstra shortest path algorithm based on python heapq heap implementation
from collections import defaultdict
from heapq import *
def dijkstra(edges, f, t):
g = defaultdict(list)
for l,r,c in edges:
q, seen = [(0,f,())], set()
while q:
kryptek /
Created September 25, 2018 23:20
Paramiko SSH
import logging
import os
import paramiko
import subprocess
import socket
import time
logging.basicConfig(level=logging.INFO, datefmt='%F %T', format='%(asctime)s %(name)s.%(module)s %(levelname)s: %(message)s')
logger = logging.getLogger('ssh_client')
kryptek /
Created September 25, 2018 23:17 — forked from jn0/
Custom paramiko-based python SSH client class to asynchronously run time-limited non-interactive commands and return exit status along with stdout and stderr.
# -*- coding: UTF-8 -*-
Custom SSH client.
1. It somehow _supports_ async execution.
2. It provides exit status.
3. It jams stdin (ssh -nT).
Run like something "python box user=bs command='echo aaa; echo bbb >&2; sleep 40; exit 23'" to test
kryptek / Chapter1
Created July 10, 2018 00:21 — forked from sh1nu11bi/Chapter1
Black Hat Python_Personal Mod Code
This code is taken fro Chapter 1-Mods included

method 1

sudo /usr/local/McAfee/AntiMalware/VSControl stopoas


sudo defaults write /Library/Preferences/com.mcafee.ssm.antimalware.plist OAS_Enable -bool False
sudo /usr/local/McAfee/AntiMalware/VSControl stop
sudo /usr/local/McAfee/AntiMalware/VSControl reload