Skip to content

Instantly share code, notes, and snippets.

@stefanocoding
stefanocoding / using_jack_and_bitwig_with_intel.md
Last active Mar 4, 2019
JACK and Bitwig using the the Intel audio chip. Tested on MacBook Pro 11,3. I get no sound using Alsa and Bitwig with the Intel chip (it works with USB interfaces), so I tried using JACK and it worked. However I had to follow these steps.
View using_jack_and_bitwig_with_intel.md
  1. Open qjackctl
  2. Click Setup...
  3. Choose "alsa" as the Driver
  4. Choose the analog interface as the Interface (in my case it is hw:PCH,0)
  5. Go to the Advanced tab
  6. Enter the number of inputs in the first textbox next to Channels I/O (2 in my case)
  7. Enter the number of outputs in the second textbox next to Channels I/O (2 in my case)
  8. Click OK
  9. Click Start
  10. Start Bitwig and select "JACK" as the Driver model
@stefanocoding
stefanocoding / does_email_address_exist.py
Last active Feb 27, 2019
Useful Python script to know if an email address exists, based on Inti's Medium post https://medium.com/intigriti/abusing-autoresponders-and-email-bounces-9b1995eb53c2
View does_email_address_exist.py
#!/usr/bin/python3
# Example usage: ./does_email_address_exist.py twitter.com jack
import argparse
from smtplib import SMTP
import dns.resolver
parser = argparse.ArgumentParser()
parser.add_argument('hostname')
parser.add_argument('user')
args = parser.parse_args()
@stefanocoding
stefanocoding / activate_intel_gpu_on_macbookpro.md
Last active Dec 28, 2018
Activate integrated Intel GPU of a MacBook Pro Mid 2014 (MacBookPro11,3) on Ubuntu 18.04
View activate_intel_gpu_on_macbookpro.md

This may work with other Macbook Pro models that have an Intel GPU and a NVidia one, but I only have proof that this works on a MacBook Pro Mid 2014 (MacBookPro11,3) with Ubuntu 18.04. If you want to be sure about which model you have, run sudo dmidecode -t system in the Terminal and you will see the information about the system including the serial number and product name (MacBookPro11,3 in my case). I'm assuming you have installed the NVidia propietary drivers, which can be installed from the application "Software & Updates" in the tab "Additional Drivers".

Steps to use the Intel GPU:

  1. Run lspci |grep VGA and check that only one line mentioning "NVIDIA" is printed. This is to be sure that you are required to do the following steps. If two lines appear, and one of those mentions "Intel", then you probably do not need to activate the GPU but only select it as the main GPU (jump to the step where you have to "Open nvidia-settings").
  2. Download apple_set_os.efi from https://github.com/0xbb/apple_se
@stefanocoding
stefanocoding / ubuntu_nvidia_macbook_backlight.md
Created Dec 18, 2018
Fix not working backlight when using NVidia propietary driver on Ubuntu 18.04 installed in a Macbook Pro Mid 2014.
View ubuntu_nvidia_macbook_backlight.md

After installing the latest NVidia proprietary driver (version 390) using Software & Updates > Additional Drivers, it wasn't possible to change the backlight intensity/brightness of the screen.

The solution that worked for me was to run: sudo setpci -H1 -s 00:01.00 BRIDGE_CONTROL=0. If that solution works for you too, then you may want to make the change permanent. Otherwise, you will have to run the same command each time you power on your Macbook.

Steps to make the change permanent:

  1. Open "Terminal"
  2. Run sudo gedit /etc/rc.local
  3. Enter:
@stefanocoding
stefanocoding / macos_on_ubuntu.md
Last active Apr 7, 2019
Install macOS in a VirtualBox machine on Ubuntu
View macos_on_ubuntu.md

Important: I'm writing this when the last version of macOS (and the one I have installed) is Mojave. There is already a script which installs Mojave in a virtual machine here https://github.com/img2tab/okiomov. But if you are curios how to do everything manually to install High Sierra, then this guide may be useful.

After reading a few articles I ended up with these steps:

  1. On macOS, download the High Sierra installer (even if you have Mojave installed): https://itunes.apple.com/us/app/macos-high-sierra/id1246284741?ls=1&mt=12
  2. If the High Sierra Installer starts, quit it.
  3. Open "Disk Utility".
  4. Click on "File" > "New Image" > "Blank image...". Or just press cmd+N.
@stefanocoding
stefanocoding / window.name.md
Created Oct 5, 2018
When `window.name` is evaluated #xss
View window.name.md

The following is not a bug in the web browsers - it's supposed to work this way - but is useful in some cases like the one described.

In one of the Javascript files loaded by an endpoint of a private program, they were taking the value of window.name and passing it to something like eval([here]) or setTimeout([here], [some_milliseconds]), I don't remember correctly... The thing is that the value of window.name was being evaluated as Javascript code, so window.name = 'alert()' showed an alert(). To use this behavior for an attack, you have two options:

  1. if the endpoint is frameable from any domain, you can create an <iframe name='[javascript_code_here]' src='[vulnerable_endpoint]'></iframe>
  2. if it's not frameable, you can set window.name = '[javascript_code_here]' in your own domain and then redirect to the vulnerable endpoint

The one I used was the second option. 💰

@stefanocoding
stefanocoding / copy_cookie_header.py
Last active May 29, 2018
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.
View copy_cookie_header.py
@stefanocoding
stefanocoding / highlight_in_scope.py
Created Apr 9, 2018
Burp Extension to highlight in the Proxy requests that are in scope
View highlight_in_scope.py
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 Feb 24, 2018
Make modem Huawei E397B work on Mac OS X
View huawei_e397b.md
  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 Oct 5, 2017
Plot curve using OpenCV instead of Matplotlib's plot().
View draw_curve.py
# 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)))
You can’t perform that action at this time.