Skip to content

Instantly share code, notes, and snippets.

@stefanocoding
stefanocoding / copy_cookie_header.py
Last active October 18, 2019 16:25
This Burp extension adds an item to the context menu - when right-clicking in the request in Proxy or Repeater - to copy the entire "Cookie" header without having to manually select it and press Ctrl+C. It's useful for me when updating session information of tabs in the Repeater for saved projects.
@stefanocoding
stefanocoding / highlight_in_scope.py
Created April 9, 2018 15:01
Burp Extension to highlight in the Proxy requests that are in scope
from burp import IBurpExtender
from burp import IProxyListener
class BurpExtender(IBurpExtender, IProxyListener):
def registerExtenderCallbacks(self, callbacks):
self.helpers = callbacks.getHelpers()
self.callbacks = callbacks
callbacks.setExtensionName('Highlight in scope')
callbacks.registerProxyListener(self)
@stefanocoding
stefanocoding / huawei_e397b.md
Created February 24, 2018 03:43
Make modem Huawei E397B work on Mac OS X
  1. Install the Connection Manager that is launched when you connect the modem to the Mac
  2. Download the source of usb_modeswitch from here http://www.draisberghof.de/usb_modeswitch/ (at the moment of writing this the file appears with the name usb-modeswitch-2.5.2.tar.bz2)
  3. Run make in the directory of the source you downloaded
  4. Run sudo ./usb_modeswitch -v12d1 -p1505 -X in the same directory

If the last step returns an error (I don't remember the error now, but I was getting an error related to usb_modeswitch not being able to take control of the modem to perfom changes):

  1. Unplug the modem and plug it again
  2. As soon as you plug the modem again, run sudo ./usb_modeswitch -v12d1 -p1505 -X repatedly until you get a successful result
  3. Open Connection Manager and your modem is going to be detected
@stefanocoding
stefanocoding / draw_curve.py
Created October 5, 2017 12:50
Plot curve using OpenCV instead of Matplotlib's plot().
# If you have something like this
matplotlib.pyplot.plot(x_values, y_values, color='yellow')
# You can do the same on OpenCV like this
curve = numpy.column_stack((x_values.astype(numpy.int32), y_values.astype(numpy.int32)))
cv2.polylines(image, [curve], False, (0,255,255))
# And if you need to plot more curves just add them as an element to the array of polygonal curves
curve1 = numpy.column_stack((x1.astype(numpy.int32), y1.astype(numpy.int32)))
curve2 = numpy.column_stack((x2.astype(numpy.int32), y2.astype(numpy.int32)))
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:443
from http.server import HTTPServer, BaseHTTPRequestHandler
import ssl
import Cocoa
let workspace = NSWorkspace.sharedWorkspace()
let activeApps = workspace.runningApplications
for app in activeApps {
if app.active {
let listOptions = CGWindowListOption(arrayLiteral: CGWindowListOption.OptionOnScreenOnly)
let windowList : NSArray = CGWindowListCopyWindowInfo(listOptions, 0)!
for window in windowList {
if (window["kCGWindowOwnerName"] as! String) == app.localizedName {