This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # This script will detect if there are any new partial download files | |
| # And launch wire/tshark to read them as a live capture. | |
| DL_DIR="$HOME/Downloads" | |
| SHARK_CMD="wireshark -k -i -" | |
| # SHARK_CMD="tshark -r -" | |
| function DL_PARTIALS { | |
| # Partial names: Chrome=$file.crdownload, Firefox=$file.part, Safari=$file.download, Edge=$file.RaNd0mStr.partial | |
| find "$DL_DIR" -maxdepth 1 | perl -ne 'print /(.*pcapng\.(part|crdownload|download|[a-zA-Z0-9]+\.partial))/' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Pcap class to more easily interact with pcaps | |
| When in doubt, aim for simplicity of requests API | |
| Like pyshark, but for the wireshark utilities | |
| """ | |
| import os | |
| import subprocess as sp | |
| import re | |
| import pprint | |
| import tempfile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # This script will get a list of all jpg and png files recursively | |
| # and convert them all in place to webp files. | |
| # cwebp options for max compression: `-m 6 -q 100 -z 9` | |
| shopt -s globstar | |
| for image in $PWD/**/*.png; do | |
| echo "File is $image" | |
| outfile=${image::-4}.webp | |
| echo "outfile is $outfile" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Evaluate a derivative of a single-variable function | |
| # Assume last argument is value/var and all others are function | |
| # Example: | |
| # $ julia derive.jl x^2 + x + 1 1 | |
| # > derivative at 1: | |
| # > 2.999999999960656 | |
| # $ julia derive.jl x^2 + x + 1 x | |
| # > derivative: | |
| # > 2 * 1 * x ^ (2 - 1) + 1 | |
| using Calculus |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Compare Powershell hash tables using a helper function. | |
| # Usage: | |
| # PS> Import-Module ./compare_hash_tables.ps1 | |
| # PS> $hash1 = @{'1'='2'; '3'=@(@{'5'='8'; 'a'='b'},'7', 'c'); 'd'=@('e')} | |
| # PS> $hash2 = @{'1'='1'; '3'=@(@{'5'='9'},'6'); 'd'=@('e','f')} | |
| # PS> Compare-Hashes $hash1 $hash2 | |
| # | |
| # : hash['3'] : list[0] : hash['5'] : <-> | |
| # -> Expected '8' | |
| # -> Actually '9' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| """Generator for Meraki API python module""" | |
| import requests | |
| import json | |
| import re | |
| api_key = '' | |
| base_url = 'https://api.meraki.com/api/v0/' | |
| # Should work for get | |
| function_text = """\ndef {0}({1}): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Using code from http://www.sunshine2k.de/articles/coding/crc/understanding_crc.html#ch5 | |
| // Using MBMS header bits from the pcap in wireshark bug#14875 | |
| // Expected output is 52 (0x34), which is the correct answer | |
| #include <stdio.h> | |
| int main(){ | |
| const int generator = 0x2f; | |
| int crc = 0; /* start with 0 so first byte can be 'xored' in */ | |
| // 0x10043b000000000000 aligned to 6 bits (from pcap) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # -*- coding:utf-8 -*- | |
| """This program aims to provide tools to troubleshoot better | |
| NOTE: Default option is yes to continue troubleshooting. No is for steps if | |
| user has not done due diligence. | |
| Assuming that categories only need to be chosen at the beginning and from | |
| then on we can employ binary questions | |
| """ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # In response to https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=14418 | |
| # First arg is filter, all other args are files | |
| # Usage: ./filter_combine.sh 'icmp' file1.pcap file2.pcap file3.pcap | |
| # Outputs `combined.pcapng` | |
| FILTER=$1 | |
| FILES=${@:2} | |
| i=0 | |
| TEMP_FILES=() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Built with Mint 17.3 based on Ubuntu 16.04 | |
| # Based on https://www.wireshark.org/docs/wsdg_html_chunked/ChSrcBuildFirstTime.html#_building_on_unix | |
| # With additional library installations found via trial and error | |
| # Install bcg729 (which is not installed by default) | |
| curl -L -O https://github.com/~/1.0.4.tar.gz | |
| tar xvzf 1.0.4.tar.gz | |
| cd bcg729-1.0.4 | |
| cmake | |
| make |