Skip to content

Instantly share code, notes, and snippets.

View kings-way's full-sized avatar
:octocat:
this guy has no status

King's Way kings-way

:octocat:
this guy has no status
View GitHub Profile
@kings-way
kings-way / build_bootable_img.sh
Last active January 1, 2023 11:57
build_bootable_img.sh
#!/bin/bash
# Author: kings_way
# Version: 20230101
# Build bootable image for BIOS and UEFI secure boot.
# Host OS: Ubuntu 20.04
set -e
KERNEL_FILE="/boot/vmlinuz"
INITRD_FILE="/boot/initrd.img"
@kings-way
kings-way / af_packet.rs
Created October 14, 2019 08:33
[rust] send raw packet with libc ('AF_PACKET' + 'send', not 'sendto')
use std::mem;
use std::io;
extern crate libc;
fn main() {
let interface_name = "lo";
let socket_fd = match get_raw_socket(interface_name){
Ok(fd) => fd,
Err(err) => {
eprintln!("Error, {}", err);
@kings-way
kings-way / af_packet.c
Last active October 14, 2019 08:34
send raw packet using 'AF_PACKET' and 'send()', instead of 'sendto'
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <net/if.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <linux/if_ether.h>
#include <linux/if_packet.h>
@kings-way
kings-way / ss_trans_proxy.sh
Last active October 14, 2019 08:35
ShadowSocks Transparent Proxy
#!/bin/sh
set -e
# The Config
server_addr ="x.x.x.x"
server_port="xxxxxx"
password="xxxxxx"
cipher="xxxxxx"
local_addr="0.0.0.0"