Skip to content

Instantly share code, notes, and snippets.

View pocc's full-sized avatar
🏠
Working from home

Ross Jacobs pocc

🏠
Working from home
View GitHub Profile
@pocc
pocc / signal_strength.sh
Last active November 10, 2018 07:07
This one liner will show the average signal noise and signal strength of all packets in an 802.11 packet capture.
#!/bin/bash
tshark -r <YOUR_WIRELESS_CAPTURE> -T fields -e "radiotap.dbm_antsignal" -e "radiotap.dbm_antnoise" \
| awk '{ sum_signal += $1; sum_noise += $2; n++ } END { if (n > 0) print '\
'"\n802.11 Avgs (dbm)\n=================\nSignal: " sum_signal / n "\nNoise: " sum_noise / n ; }'
#!/usr/bin/env python3
#-*- coding:utf-8 -*-
# Modified existing script for PyQt5 (https://stackoverflow.com/questions/14090353/)
from PyQt5 import QtCore
from PyQt5.QtWidgets import QWidget, QLineEdit, QPushButton, QHBoxLayout, \
QMainWindow, QApplication
class widgetB(QWidget):
procDone = QtCore.pyqtSignal(str)
@pocc
pocc / install-network-manager-l2tp.sh
Created September 7, 2018 21:12
Install network-manager-l2tp on linux distros from source (rough draft)
#!/bin/bash
# This script will install network-manager-l2tp on linux distros from source.
# Only instructions x86_64, per https://github.com/nm-l2tp/network-manager-l2tp
# Untested everywhere (i.e. this is a rough draft)
# Get the required files
git clone https://github.com/nm-l2tp/network-manager-l2tp.git
cd network-manager-l2tp
git checkout 1.2.2
@pocc
pocc / test_simple_calculator.py
Created September 2, 2018 01:12
Unittest practice with arithmetic functions
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Unittest practice
This program does basic arithmetic and provides a test class to test it.
# Running
python3 -m unittest test_simple_calculator.py
"""
import unittest
@pocc
pocc / shark_wrappyr.py
Created August 19, 2018 05:41
Script that takes a pcap and filters and returns the filtered pcap using tshark. Tshark is faster than any python library while still maintaining wireshark syntax.
#!/usr/bin/env python3
# encoding=UTF-8
"""
### SharkWrappyr ###
This script is a python wrapper for tshark that takes a pcap and filters
and returns the filtered pcap. Requires tshark to be installed.
Usage: filtered_pcap = shark_wrappyr(pcap_in, pcap_filters)
"""
import subprocess
@pocc
pocc / inheritance-methods.py
Created July 22, 2018 07:18
Playing around with Python Inheritance
class First(object):
def __init__(self):
super(First, self).__init__()
print("first")
def print_b(self):
print('b')
class Second(First):
def __init__(self):
@pocc
pocc / repo-to-branch.sh
Created June 28, 2018 21:53
Converts a repo to a branch on another repo
#!/bin/bash
# This script will move the files in a repository into a branch in another repository
# arg 1 is file source repo 1, arg 2 is repo 2 that will get a new branch
# arg 3 is repo 1 name, arg 4 is repo 2 name, arg 5 is the branch name
# Get files
cd /tmp
git clone $1
git clone $2
cd $4
@pocc
pocc / whois_host.sh
Created May 30, 2018 20:09
Whois with hostname
whois $(dig +short $1 | tail -n -1)
@pocc
pocc / vimwiki.vimrc
Last active May 21, 2018 04:19
Get a vimwiki up quickly
" *** Get a vimwiki with markdown support up quickly ***
" 1. git clone https://github.com/vimwiki/vimwiki.git ~/.vim/pack/plugins/start/vimwiki
" 2. Paste/append this file to ~/.vimrc
" 3. Change the location of the vimwiki path
"Vimwiki settings
set nocompatible
filetype plugin on
syntax on
@pocc
pocc / original.vimrc
Last active July 23, 2018 17:17
Original vimrc
" Ross Jacobs' original .vimrc
" VUNDLE
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()