Skip to content

Instantly share code, notes, and snippets.

View peta909's full-sized avatar
🏠
Working from home

Mark Lim peta909

🏠
Working from home
View GitHub Profile
@peta909
peta909 / Select_person.py
Last active February 15, 2019 23:31
Using Python Dict and accessing key and value using indexes
food_cook_dict = {
"pasta" : "Aaron",
"bread" : "Thomas",
"rice" : "John",
"Soup" : "Kate",
"noodles" : "Liam",
}
# dictionary are unordered unlike lists till python 3.6
@peta909
peta909 / CPP_CheatSheet.cpp
Last active February 20, 2019 02:19
C++ explaination for use of inline and const keywords; and recursive functions
#include <iostream>
#include <string>
using namespace std;
enum Animals { Bear, Cat, Chicken };
//enum Birds { Eagle, Duck, Chicken }; // error! Chicken has already been declared!
enum class Fruits { Apple, Pear, Orange };
enum class Colours { Blue, White, Orange }; // no problem!
#include <iostream>
#include <string>
using namespace std;
class Fighters {
public:
string model;
int Health;
int Strength;
void add_stealth();
@peta909
peta909 / Class_OOP_inheritance_DynamicMem.cpp
Last active February 25, 2019 02:41
Demo use of OOP inheritance and use of Dynamic member to create new objects
#include "pch.h"
#include <iostream>
#include <string>
using namespace std;
//Parent Class
class Animal
{
public:
string name;
#include "pch.h"
#include <iostream>
#include <string>
using namespace std;
//Parent Class
class Animal
{
public:
string name;
// Function_Pointers.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include "pch.h"
#include <iostream>
#include <string>
using namespace std;
int add()
@peta909
peta909 / Python_CheatSheet.py
Last active March 29, 2019 03:54
Python code with comments
from math import *
import struct
'''
This is
Multi
Line
comment
'''
@peta909
peta909 / hello_world_plugin.py
Created April 26, 2019 00:47 — forked from cmatthewbrooks/hello_world_plugin.py
The simplest possible IDA plugin with multiple actions
##############################################################################
#
# Name: hello_world_plugin.py
# Auth: @cmatthewbrooks
# Desc: A test plugin to learn how to make these work; Specifically, how to
# have multiple actions within the same plugin.
#
# In plain English, IDA will look for the PLUGIN_ENTRY function which
# should return a plugin object. This object can contain all the
# functionality itself, or it can have multiple actions.

manual import resolution

example from 0f5d5d07c6533bc6d991836ce79daaa1:

_0:00F20012 33 D2                   xor     edx, edx
_0:00F20014 64 8B 52 30             mov     edx, fs:[edx+30h] // TEB->PEB
_0:00F20018 8B 52 0C                mov     edx, [edx+0Ch]    // PEB->LDR_DATA
_0:00F2001B 8B 52 14                mov     edx, [edx+14h]    // LDR_DATA->InMemoryOrderLinks (_LDR_DATA_TABLE_ENTRY)
                                                              // alt: 0xC: InLoadOrderLinks
 // alt: 0x1C: InInitializationOrderLinks
//this requires being able to run at kernel mode and assumes you're using MSVC
//this also uses an unnamed structure for cr0_t, which is a nonstandard extension of the C language
//data structure for cr0
typedef union _cr0_t
{
struct
{
uint64_t protection_enable : 1;