Skip to content

Instantly share code, notes, and snippets.

View shahril96's full-sized avatar
🐢

Mohd Shahril shahril96

🐢
View GitHub Profile
@littlelailo
littlelailo / apollo.txt
Created September 27, 2019 12:04
Apple Bootrom Bug
This bug was also called moonshine in the beginning
Basically the following bug is present in all bootroms I have looked at:
1. When usb is started to get an image over dfu, dfu registers an interface to handle all the commands and allocates a buffer for input and output
2. if you send data to dfu the setup packet is handled by the main code which then calls out to the interface code
3. the interface code verifies that wLength is shorter than the input output buffer length and if that's the case it updates a pointer passed as an argument with a pointer to the input output buffer
4. it then returns wLength which is the length it wants to recieve into the buffer
5. the usb main code then updates a global var with the length and gets ready to recieve the data packages
6. if a data package is recieved it gets written to the input output buffer via the pointer which was passed as an argument and another global variable is used to keep track of how many bytes were recieved already
7. if all the data was recieved th
@L0SG
L0SG / freeze_example.py
Last active October 12, 2023 05:02
PyTorch example: freezing a part of the net (including fine-tuning)
import torch
from torch import nn
from torch.autograd import Variable
import torch.nn.functional as F
import torch.optim as optim
# toy feed-forward net
class Net(nn.Module):
def __init__(self):
@jojobyte
jojobyte / ContextCmder-Disable.reg
Last active October 5, 2023 13:13
Cmder Context (Right-Click) Menu for Windows 7, 8, 10 & 11
Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\Directory\Background\shell\Cmder]
[-HKEY_CLASSES_ROOT\Directory\shell\Cmder]
@mokhdzanifaeq
mokhdzanifaeq / extract.py
Last active July 4, 2023 03:30
extract data embeded in pixel channels
from PIL import Image
import argparse
from collections import OrderedDict
def parseMask(string):
mask = []
for val in string.split(","):
if "-" in val:
min, max = val.split("-")
mask += [1 << (i - 1) for i in range(int(min), int(max) + 1)]
@Steven-Rose
Steven-Rose / gist:3943830
Created October 24, 2012 04:27
VI: Select all + delete, select all + copy
Select all and delete (actually move to buffer)
:%d
Select all and copy to buffer
:%y
Use p to paste the buffer.
@Apsu
Apsu / uefisetup.sh
Last active July 8, 2021 03:54
Arch Linux UEFI Setup
# **************** READ THIS FIRST ******************
#
# This is not a script for you to run. I repeat, do not download and run this!
#
# This is only a guide to show the required steps for successful UEFI + GRUB2 installation
# Many of the choices are examples or assumptions; don't blindly type shit into your machine
# until/unless you at least read the comments around each command
#
# These steps assume you've booted in UEFI mode by preparing your USB stick per these instructions:
# https://wiki.archlinux.org/index.php/UEFI#Archiso
@hugsy
hugsy / checksec.c
Last active March 5, 2021 16:31
PE version of checksec.sh
/**
* Poor version of checksec.sh script for PE (checks for ASLR, NX, Integrity, SEH flags)
*
* Copy/Paste commands
* c:\> dir /s /b *.dll > DllList.txt
* c:\> checksec.exe -f DllList.txt > DllList_checksec.txt
*
* @ref
* https://msdn.microsoft.com/en-us/library/windows/desktop/ms680339(v=vs.85).aspx
*/
@jas-
jas- / .gdbinit
Last active May 13, 2020 20:29
Memory scraping
python
sys.path.insert(0, '/path/to/module/dir')
import hexdump
end
@ThunderCls
ThunderCls / darktheme_modded.ini
Last active November 20, 2019 09:11
Dark Theme Modded by ThunderCls (http://i.imgur.com/y3mcIRu.png)
[Colors]
AbstractTableViewBackgroundColor=#272822
AbstractTableViewHeaderTextColor=#000000
AbstractTableViewSelectionColor=#363930
AbstractTableViewSeparatorColor=#555A4C
AbstractTableViewTextColor=#FFFFFF
DisassemblyAddressBackgroundColor=#XXXXXX
DisassemblyAddressColor=#AE81FF
DisassemblyAutoCommentBackgroundColor=#XXXXXX
DisassemblyAutoCommentColor=#CF780D
@rsds143
rsds143 / tmux.conf
Created January 21, 2011 05:39
my tmux file
# $Id: vim-keys.conf,v 1.2 2010/09/18 09:36:15 nicm Exp $
#
# vim-keys.conf, v1.2 2010/09/12
#
# By Daniel Thau. Public domain.
#
# This configuration file binds many vi- and vim-like bindings to the
# appropriate tmux key bindings. Note that for many key bindings there is no
# tmux analogue. This is intended for tmux 1.3, which handles pane selection
# differently from the previous versions