Skip to content

Instantly share code, notes, and snippets.

View shahril96's full-sized avatar
🐢

Mohd Shahril shahril96

🐢
View GitHub Profile
@shahril96
shahril96 / arguments_analysis.asm
Created February 26, 2015 07:52
Analysis of assembly language output produced by C code that accepting string argument from Terminal perimeter
/*
#include <stdio.h>
int main(int argc, char *argv[])
{
puts(""); // space
if(argc == 1)
{
@shahril96
shahril96 / socat-reverse-shell.sh
Last active January 15, 2024 13:29
Post-exploitation reverse shell using socat plus encrypted connection
#!/usr/bin/env bash
# Author : shahril96
# Licensed under the WTFPL license - http://www.wtfpl.net/about/
# Make sure only root can run our script
[[ $EUID -ne 0 ]] && { echo "This script must be run as root" 1>&2; exit 1; }
# print help msg if not enough argument given
[ $# -ne 1 ] && { echo "Usage: `basename $0` port-to-listen"; exit 1; }
@shahril96
shahril96 / uncompyle6-recursive.sh
Created May 30, 2019 19:49
Decompile all pyc files recursively under current directory
find . -name "*.pyc" -execdir uncompyle6 -o . {} \;
@shahril96
shahril96 / php_encoder.php
Created February 3, 2015 17:32
Simple PHP Obfuscator
// this was my attempt to write my own php obfuscator
// this was inspired by Carbylamine PHP Script Encoder
// its currently in alpha, because sometimes its work, and sometimes it doesnt
// this was written 3 years ago (ahh memories again)
// so code looks suck
// thanks to Mokhdzani Faeq for created good regexs
// have fun!
<?php
@shahril96
shahril96 / domjudge-setup.sh
Last active July 19, 2023 14:31
A helper script to automatically setup a DOMjudge server in 10 minutes, go get yourself a coffee.
#!/usr/bin/env bash
#
# This is a script that can automatically
# setup DOMjudge server & judgehost, inside a same server.
#
# As a bonus, this script will also setup a beautiful DOMjudge
# interface made using React, which it will listen on port 8080.
#
# This script assumes that:
@shahril96
shahril96 / matrix.py
Last active July 13, 2023 14:31
Exploit for PicoCTF's Enter the Matrix challenge.
from pwn import *
import struct
import binascii
FREE_GOT = 0x804a10c
SETBUF_GOT = 0x804a104
FREE_LIBC = 0x76110 # pico: 0x76110, local: 0x712f0
SYSTEM_LIBC = 0x3e3e0 # pico: 0x3e3e0, local: 0x3ada0
@shahril96
shahril96 / postfix.java
Created February 19, 2016 06:32
Infix to Postfix - Java Converter (no invalid expressions checking)
import java.util.*;
public class postfix {
public static void main(String args[]) {
String infix = "x-(y*a/b-(z+d*e)+c)/f";
System.out.println("Infix : " + infix);
System.out.println("Postfix : " + inf2postf(infix));
@shahril96
shahril96 / pi.c
Created July 26, 2015 05:34
Implementation of Chudnovsky's algorithm to calculate approximation of Pi using C
#include <stdio.h>
#include <math.h>
#define SIZE 100
unsigned __int128 fact(int N) // calculate factorial with O(n)
{
static unsigned __int128 memo[SIZE] = {-1};
if(memo[N] > -1) return memo[N];
else return memo[N] = (N <= 1) ? 1 : fact(N-1) + fact(N-2);
@shahril96
shahril96 / struct_qsort.c
Last active January 23, 2023 01:36
Example of sorting struct using qsort inside standard C
/* Performance of qsort, worst case O(n log n)
Example input :
3
4 9
-3 48
-100 48
Example output :
@shahril96
shahril96 / float2ieee754.c
Last active November 9, 2022 11:58
Floating Point to IEEE 754 32-bit Converter
// Floating Point to IEEE 754 32-bit Converter
// this was written when i'm started to learn C
// code look suck, well, this shit is from 2 years ago :) (ahh unforgotten memories)
// hope you can learn somethings from this code
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h> // to use bool (c99 standard)