Skip to content

Instantly share code, notes, and snippets.

@deqline
deqline / intellitip.py
Created November 26, 2022 16:34
Better sublime text 3 intellitip extension (replace py in packages). Gives function description and syntax on hover.
import sublime_plugin, sublime, json, webbrowser
import re, os
from time import time
settings = {}
class IntellitipCommand(sublime_plugin.EventListener):
cache = {}
region_row = []
@deqline
deqline / main.js
Last active September 21, 2022 14:04
Remove ID'S text in Obsidian_to_Anki plugin folder in your vault workspace -> replace functions in main.js in installed plugins folder
function id_to_str(identifier, inline = false, comment = false) {
let result = "ID: " + identifier.toString();
if (comment) {
result = "<!--" + result + "-->";
}
if (inline) {
result += " ";
}
else {
result += "\n";
@deqline
deqline / dispyc.py
Created April 21, 2022 08:25
Easily decompile `.pyc` and `.py` files for the latest python version.
####
# Easily decompile `.pyc` and `.py` files for the latest python version.
# Basic structure taken from https://nedbatchelder.com/blog/200804/the_structure_of_pyc_files.html, fully updated and added functionality.
# Added complete disassembly: offsets, opcodes, opnames...
####
import dis, marshal, struct, sys, time, types, py_compile
def to_int(bytes):
return struct.unpack("i",bytes)[0]
@deqline
deqline / gen_shellcode_masm.py
Last active April 2, 2021 11:42
Generates shellcode from a masm compiled file. Instructions in file comments!.
# Create a shellcode.ASM file
# the shellcode shall reside in the text segment
# compile it using ml64 /c shellcode.ASM
# run this file
f = open("shellcode.obj", "rb")
stream = f.read()
SizeOfFileHeader = 0x14
SizeOfBuffer = int.from_bytes(stream[SizeOfFileHeader+0x10:SizeOfFileHeader+0x14], "little") #SizeOfRaw Text segment
@deqline
deqline / FindPattern.py
Created March 23, 2021 22:11
Find all the occurences of pattern in a byte buffer using python.
#usage python FindPattern.py sequence pattern
import sys
def str_to_bytes(_bytes):
current = ""
sequence = bytearray()
for ltr in _bytes:
for i in range(2):
current += ltr
sequence.append(int(current, 16))