Skip to content

Instantly share code, notes, and snippets.

View picatz's full-sized avatar
Graph Theory

Kent Gruber picatz

Graph Theory
View GitHub Profile
@picatz
picatz / hexdump_capture_monitor_mode.cr
Created November 6, 2017 01:02
Packetz : Packets Capturing in Monitor Mode
require "packetz"
capture = Packetz.capture
capture.enable_monitor_mode! if capture.supports_monitor_mode?
capture.start!
capture.each do |packet|
puts packet.hexdump
@picatz
picatz / install_msf.sh
Created November 9, 2017 03:13
Ubuntu Xenial64 -- Install Metasploit Framework
# Built ontop of the work started by this gangster:
# https://www.darkoperator.com/installing-metasploit-in-ubunt/
function install::updates() {
sudo apt-get update -y
}
function install::upgrades() {
sudo apt-get upgrade -y
}
@picatz
picatz / get_interface.c
Created November 15, 2017 19:14
Get interface to listen on
#include <pcap.h>
int main()
{
char *dev;
char errbuf[PCAP_ERRBUF_SIZE];
dev = pcap_lookupdev(errbuf);
/* Check for failure */
@picatz
picatz / get_interface.cr
Last active November 15, 2017 20:03
Get interface to listen on
@[Link("pcap")]
lib LibPcap
PCAP_ERRBUF_SIZE = UInt8.new(256)
fun pcap_lookupdev(errbuf : LibC::Char* ) : LibC::Char*
end
err = LibPcap::PCAP_ERRBUF_SIZE.dup
dev = LibPcap.pcap_lookupdev(pointerof(err))
raise Exception.new("Couldn't find a default interface: #{String.new(err)}") if dev.null?
@picatz
picatz / pcap_lookupdev.cr
Created November 15, 2017 20:06
pcap_lookupdev binding in crystal
@[Link("pcap")]
lib LibPcap
PCAP_ERRBUF_SIZE = UInt8.new(256)
fun pcap_lookupdev(errbuf : LibC::Char*) : LibC::Char*
end
@picatz
picatz / pcap_lookupdev_usage.cr
Created November 15, 2017 20:10
Using pcap_lookupdev binding
err = LibPcap::PCAP_ERRBUF_SIZE.dup
dev = LibPcap.pcap_lookupdev(pointerof(err))
raise Exception.new("Couldn't find a default interface: #{err}") if dev.null?
puts String.new(dev)
@picatz
picatz / pcap_open_live_and_next.cr
Last active November 16, 2017 01:26
Using pcap_open_live
@[Link("pcap")]
lib LibPcap
# previous code ...
type PcapT = Void*
alias UChar = UInt8
alias BpfUInt32 = LibC::UInt
struct Timeval
tv_sec : LibC::Long
@picatz
picatz / capture_hexdump.cr
Created November 16, 2017 01:35
Using pcap_open_live
# previous code ...
err = LibPcap::PCAP_ERRBUF_SIZE.dup
cap = LibPcap.pcap_open_live("en0", 65535, 0, 1, pointerof(err))
raise Exception.new("An error happened: #{String.new(err)}") if cap.null?
loop do
result = LibPcap.pcap_next_ex(cap, out pkt_header, out pkt_data)
case result
<div class="container container-fluid">
<ul class="list-group" id="banners"></ul>
</div>
<script>
var json;
var source = new EventSource('/api/live_banners');
source.onmessage = function(evnt) {
json = JSON.parse(evnt.data);
addBanner(json);
}
@picatz
picatz / fresh_kali_msf.sh
Created December 1, 2017 19:17
Fresh Kali Start MSF
service postgresql start
msfdb init
msfconsole