This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define _GNU_SOURCE | |
#include <unistd.h> | |
#include <dlfcn.h> | |
#include <sys/mman.h> | |
#include <link.h> | |
#include <errno.h> | |
/* | |
- info: pointer to a dl_phdr_info { | |
ElfW(Addr) dlpi_addr; // Base address of object |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define _GNU_SOURCE | |
#include <unistd.h> | |
#include <dlfcn.h> | |
#include <sys/mman.h> | |
#include <link.h> | |
#include <errno.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
void *begin; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fpdf import FPDF | |
from path import Path | |
import sys | |
imagelist = [x for x in sorted(Path(sys.argv[1]).listdir()) if x.ext == ".jpg"] | |
pdf = FPDF() | |
for im in imagelist: | |
pdf.add_page(orientation="P", format=(410,550)) #Size of images is known |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
#require zsh and colordiff (credits: https://superuser.com/questions/125376/how-do-i-compare-binary-files-in-linux) | |
diff -y <(xxd $1) <(xxd $2) | colordiff |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
import sys | |
url_input = ("file://" if not sys.argv[1].startswith("http") else "") + sys.argv[1] | |
image_output = sys.argv[2] | |
driver = webdriver.Chrome() # or PhantomJS() not to open a windows (require phantomjs) | |
driver.get(url_input) | |
if driver.save_screenshot(image_output): | |
print("Save ok !") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import lxml.html | |
from path import Path | |
import wikipedia | |
import requests | |
def dl_image(search_str): | |
page = wikipedia.page(search_str) | |
html = lxml.html.fromstring(page.html()) | |
imgs = html.xpath("//img") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
file = "/run/user/1000/jupyter/kernel-7365.json" | |
from jupyter_client.blocking import BlockingKernelClient | |
client = BlockingKernelClient(connection_file=file) | |
client.load_connection_file() | |
client.start_channels() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from multiprocessing import Process, Queue | |
def deadline(timeout, f, *args): | |
queue = Queue() #using to get the result | |
def subproc_function(queue, f, *args): | |
res = f(*args) | |
queue.put(res) | |
proc = Process(target=subproc_function, args=(queue, f) +args) #creation of a process calling longfunction with the specified arguments | |
proc.start() #lauching the processus on another thread | |
try: | |
res = queue.get(timeout=timeout) #getting the resultat under 1 second or stop |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ida_kernwin | |
import ida_loader | |
ss = ida_loader.snapshot_t() | |
ida_loader.build_snapshot_tree(ss) | |
ccs = list(ss.children) | |
def callback(param1, param2): |