This file contains 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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from lief import PE | |
# Constants | |
IMAGE_BASE = 0x02060000 | |
ENTRY_POINT_OFFSET = 0x734 | |
CODE_PAYLOAD_FILE = 'explorer_02060000.bin' | |
DATA_PAYLOAD_FILE = 'explorer_00B60000.bin' | |
FILE_ALIGNMENT = 0x200 |
This file contains 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
############################################################################################ | |
## | |
## One-Click Hex Copy! | |
## | |
## Updated for IDA 7.xx | |
## | |
## All credit for actual IOCTL decode logic: | |
## http://www.osronline.com/article.cfm?article=229 | |
## | |
## Big thanks to @gaasedelen for the IDA 7 update ideas: |
This file contains 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 _WIN32_WINNT 0x0501 | |
#define _GLIBCXX_USE_C99 1 | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <windows.h> | |
#include <iostream> | |
#include <string> | |
#include <sstream> |
This file contains 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
[INFO] [2020-01-08 16:37:03,477] <module>(): [+] Original buffer: ['0', '1', '2', '2', '2', '2', '0', '1', '2', '2', '2', '2'] | |
[INFO] [2020-01-08 16:37:03,477] <module>(): [+] Compressed list: [['0', 2], ['1', 2], ['2', 8]] | |
[INFO] [2020-01-08 16:37:03,477] <module>(): [+] Compression rate: 75.00% |
This file contains 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
class NGram: | |
def __init__(self, order): | |
self.order = order | |
self.buffer = [] | |
def add(self, element): | |
tmp = None | |
if not element: | |
return tmp |
This file contains 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
class Compressor: | |
def init(level): | |
buffer = List(level*2) | |
def add(element): | |
tmp = None | |
if not element: | |
return tmp | |
if len(buffer) == level*2: |
This file contains 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
compressors = [] | |
for i in range(1,level): | |
compressors.append(Compressor(i)) | |
for e in data: | |
e1 = checksum(e) | |
c = compressors[0] | |
out = c.add(e1) | |
for c in compressor[1:]: | |
out = c.add(out) |
This file contains 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
['call_0', 'call_1', 'call_2', 'call_2', 'call_2', 'call_2', 'call_0', 'call_1', 'call_2', 'call_2', 'call_2', 'call_2'] | |
[{'label': 'call_0', 'repeated': 2}, {'label': 'call_1', 'repeated': 2}, {'label': 'call_2', 'repeated': 8}] |
This file contains 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 os | |
import sys | |
import logging | |
import hashlib | |
import numpy | |
from random import randint | |
from itertools import groupby, chain | |
logger = logging.getLogger(__name__) |
This file contains 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
data = [0, 1, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2] | |
lrs = calculate_lrs(data) # [0, 1, 2, 2, 2, 2] <= First While | |
while lst: | |
lrs = calculate_lrs() | |
# [2, 2] <= Second while |
NewerOlder