Skip to content

Instantly share code, notes, and snippets.

@TrungNguyen1909
TrungNguyen1909 / mul53.c
Last active January 10, 2024 08:46
Apple H10 Mul53 extension
#if 0
Apple A11 (H10) introduces 2 propietary instructions called mul53lo.2d and mul53hi.2d. All of which belongs to Mul53 extensions.
Defintions:
- mul53lo.2d Vd, Vm: Multiplies 2 53-bit doublewords in the Vn vector with 2 53-bit doublewords in Vm vector and store 53 lowest bits in the Vn vector.
- mul53hi.2d Vd, Vm: Multiplies 2 53-bit doublewords in the Vn vector with 2 53-bit doublewords in Vm vector and store the result shifted 53 bits in the Vn vector.
Encodings:
- mul53lo.2d Vd, Vm: 0x00200000 | (m << 5) | (d << 0)
- mul53hi.2d Vd, Vm: 0x00200400 | (m << 5) | (d << 0)
@TrungNguyen1909
TrungNguyen1909 / sysreg.c
Last active September 11, 2022 22:14
A13 instructions and system registers
//FIRESTORM: only FIRESTORM (A14/M1)
//LIGHTNING: only Lightning (A13)
#define FIRESTORM
int main() {
__asm__ __volatile__("isb sy\n"
".long 0x00200000\n" //mul53lo.2d v0, v0
".long 0x002003ff\n" //mul53lo.2d v31, v31
".long 0x00200400\n" //mul53hi.2d v0, v0
".long 0x002007ff\n" //mul53hi.2d v31, v31
".long 0x00200800\n" //wkdmc x0, x0
@TrungNguyen1909
TrungNguyen1909 / reee-z3.py
Created April 30, 2020 11:31
Another Z3 crackme Solver
from z3 import *
import sys
sys.setrecursionlimit(133337)
unk = [72, 95, 54, 53, 53, 37, 20, 44, 29, 1, 3, 45, 12, 111, 53, 97, 126, 52, 10, 68, 36, 44, 74, 70, 25, 89, 91, 14, 120, 116, 41, 19, 44, 0]
length=33
s = Solver()
vec = ""
for i in range(length):
vec += F"{i} "
m = BitVecs(vec,8)
@TrungNguyen1909
TrungNguyen1909 / double.s
Created March 19, 2020 08:36
Double a number in ARM
.section .text
.global _start
atoi:
push {fp, lr}
mov fp, sp
push {r6, r8, r9, r10}
add r2, r0, r1
add r8, r0, #0
mov r10, #0
@TrungNguyen1909
TrungNguyen1909 / spellcheck.py
Last active June 11, 2020 03:40
Simple spellchecker
from collections import Counter
import sys
import re
WORDLIST = input("Enter dictionary path:")
WORDS = Counter([a.strip() for a in open(WORDLIST).readlines()])
def P(word, N=sum(WORDS.values())):
"Probability of `word`."
#!/usr/bin/env python3
import requests
import sys
import re
import xml.etree.ElementTree as ET
tp = r'<table border="1">.*<\/table>'
print('WHOIS (pronounced as the phrase "who is") is a query and response protocol that is widely used for querying databases that store the registered users or assignees of an Internet resource.')
print('A reverse WHOIS lookup takes a registered user or assignee \'s name to find the domains that he or she owns.')
q = input("Enter Query for Reverse WHOIS lookup:")
@TrungNguyen1909
TrungNguyen1909 / portscan.py
Created December 8, 2019 09:07
Python open port scanner
#!/usr/bin/env python3
import socket
import sys
import threading
HOST = sys.argv[1]
SERVER = socket.gethostbyname(HOST)
print(F"[*] Port Scanning on {SERVER}")
def scan(start,end):
for PORT in range(start,end):
@TrungNguyen1909
TrungNguyen1909 / easy-crack-me-z3.py
Created October 30, 2019 14:50
z3 solver example
from z3 import *
s = Solver()
s.set(unsat_core=True)
def is_valid(x):
return Or(
(x==ord('0')),
(x==ord('1')),
(x==ord('2')),
(x==ord('3')),
(x==ord('4')),
@TrungNguyen1909
TrungNguyen1909 / manager.cpp
Last active December 8, 2018 03:39
Communication/Interactive checker for CMS
#include <bits/stdc++.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <signal.h>
using namespace std;
void handler(int signum){
cout<<0;
cerr<<"Idleness limit Exceeded!";
exit(0);
from urllib.request import urlopen,urlretrieve
import urllib
import sys
import json
key="ACCESS_KEY"
width=1920
height=1080
url="https://api.unsplash.com/photos/random?orientation=landscape&w="+str(width)+"&h="+str(height)+"&client_id="+key
response=""
try: