Skip to content

Instantly share code, notes, and snippets.

View vagueanxiety's full-sized avatar
🍨

Zhihang Zhang vagueanxiety

🍨
  • 19:52 (UTC -07:00)
View GitHub Profile
@vagueanxiety
vagueanxiety / xz-backdoor.md
Created March 29, 2024 22:21 — forked from thesamesam/xz-backdoor.md
xz-utils backdoor situation

FAQ on the xz-utils backdoor

Background

On March 29th, 2024, a backdoor was discovered in xz-utils, a suite of software that gives developers lossless compression. This package is commonly used for compressing release tarballs, software packages, kernel images, and initramfs images. It is very widely distributed, statistically your average Linux or macOS system will have it installed for

ELF Format Cheatsheet

Introduction

Executable and Linkable Format (ELF), is the default binary format on Linux-based systems.

ELF

Compilation

@vagueanxiety
vagueanxiety / c_nostd.txt
Created June 9, 2023 06:33 — forked from tcoppex/c_nostd.txt
Writing C software without the standard library [Linux Edition] - Franc[e]sco's Gopherspace
###################################################################
Writing C software without the standard library
Linux Edition
###################################################################
There are many tutorials on the web that explain how to build a
simple hello world in C without the libc on AMD64, but most of them
stop there.
I will provide a more complete explanation that will allow you to
build yourself a little framework to write more complex programs.
float ph = 234.4;
float temp = 22.2;
printf("\n\ntemp: %f\nph: %f\n", temp, ph);
char buffer[200] ;
sprintf(buffer, "Temperature: %.2f \nPH: %f", temp, ph);
printf("%s\n", buffer);
onPress = () => {
return fetch("http://www.agis-mapp.xyz/doctors", {
method: "POST",
headers: {
Accept: "application/json",
"Content-Type": "application/json"
},
body: JSON.stringify({
email: this.state.email,
password: this.state.password,
@vagueanxiety
vagueanxiety / ARC4.py
Created October 11, 2018 17:19
Python Implementation of ARC4 and Brute force cracking
# NOTE:
# keylength is the number of bytes in that key
# pad is xor'ed on character parts
def get_pad(key, message_length):
keylength = len(key)
pad = [None] * message_length
s = []
#-- key-scheduling algorithm: initialize the s array
for i in range(256):
s.append(i)
@vagueanxiety
vagueanxiety / Reuleaux_triangle.py
Last active October 6, 2018 04:22
Using p5 to draw a Reuleaux_triangle based on the middle point algorithm
from p5 import *
import math
triangle_center_x = 80
triangle_center_y = 60
diameter = 80
bottom_arc = 0
right_arc = 1
left_arc = 2
@vagueanxiety
vagueanxiety / Bresenham.py
Last active September 30, 2018 17:57
CPEN311 - Bresenham Circle Algorithm
def setPixel(x, y):
print("x is {x}, y is {y}. ".format(x = x, y = y))
def draw_circle(centre_x, centre_y, radius):
offset_y = 0
offset_x = radius
crit = 1 - radius
while offset_y <= offset_x:
print("crit is {c}, off_x is {x}, off_y is {y}. ".format(x = offset_x, y = offset_y, c = crit))