Skip to content

Instantly share code, notes, and snippets.

# Sniff packets with Scapy and print just the payload:
contact = bt.sniff(lfilter=lambda p: EIR_ServiceData16BitUUID in p and 0xfd6f == p[EIR_ServiceData16BitUUID].svc_uuid, prn=lambda x: print(x[EIR_ServiceData16BitUUID][Raw].load), count = 10)
# Spoof packets with Scapy
payload = "ABCD" * 8 #128 bits
t = HCI_Hdr(type="Event")/HCI_Event_Hdr(code=0x3e)/HCI_Event_LE_Meta(event="advertising_report")/HCI_LE_Meta_Advertising_Reports(len=1, reports=[HCI_LE_Meta_Advertising_Report(type=3, atype="random", addr="11:22:33:44:55:66", data=[EIR_Hdr(type="svc_data_16_bit_uuid")/EIR_ServiceData16BitUUID(svc_uuid=0xfd6f)/Raw(load=payload)])])
bt.sr(t) #this doesn't seem to work. hmm.
# Sniff packets with bluepy
scanner = Scanner().withDelegate(ScanDelegate())
@bensmith83
bensmith83 / collatz.py
Created January 2, 2020 02:15
Quick python to calculate collatz conjecture numbers and the amount of steps to get there.
start = 3
most_steps_num = 0
most_steps_steps = 0
while True:
#number = input("enter a number to test the Collatz Conjecture\n")
#number = int(number)
#orig = number
number = start
steps = 0
while number > 1:
from scapy.all import *
from asn1crypto import x509
def main():
# if you want to use a pcap...
#a = rdpcap("/Users/ben/Documents/98:01:a7:9d:b1:87_eap.pcapng")
#process_packets(a)
syntax on " syntax highliting
"set number " line numbers
filetype plugin indent on " tabs by filetype
set tabstop=4 " 4 spaces for a tab
set shiftwidth=4 " 4 spaces for shift
set expandtab " no tabs, just spaces
set smarttab " auto indenting
" added these
set ruler
colorscheme desert

Keybase proof

I hereby claim:

  • I am bensmith83 on github.
  • I am bensmith83 (https://keybase.io/bensmith83) on keybase.
  • I have a public key whose fingerprint is 47AD C8CA 3905 5CFA C224 AD37 9ED4 B60E EC5A 76A1

To claim this, I am signing this object: