Skip to content

Instantly share code, notes, and snippets.

View ujade's full-sized avatar

Jade ujade

View GitHub Profile
use std::collections::HashMap;
#[derive(Clone)]
struct SpeciesData {
id: u32,
name: String,
base_hp: u32,
base_attack: u32,
}
@ujade
ujade / simd-fibonacci-rs.rs
Last active December 1, 2023 02:47
fibonacci sequence in rust using SIMD
use std::arch::x86_64::*;
fn simd_fibonacci(n: usize) -> Vec<u128> {
assert!(is_x86_feature_detected!("avx2"));
let mut a = unsafe { _mm256_set1_epi64x(0) };
let mut b = unsafe { _mm256_set1_epi64x(1) };
let mut result = Vec::with_capacity(n);
use std::process::Command;
use std::fs::OpenOptions;
use std::io::{self, Write, Seek, SeekFrom};
use std::path::PathBuf;
fn main() -> io::Result<()> {
println!("Enter the path to your ELF: ");
let mut elf_path = String::new();
io::stdin().read_line(&mut elf_path)?;
let elf_path = elf_path.trim();
@ujade
ujade / main.rs
Created May 7, 2023 21:05
blocks non-MS DLLs from being loaded into your process. ported from c++
extern crate winapi;
use std::mem;
use std::ptr;
use std::ffi::CString;
use std::io::Error;
use winapi::um::processthreadsapi::SetProcessMitigationPolicy;
use winapi::um::winnt::{PROCESS_MITIGATION_BINARY_SIGNATURE_POLICY, PROCESS_SIGNATURE_POLICY};
use winapi::shared::minwindef::BOOL;
use winapi::um::winnt::{BOOLEAN, NTSTATUS, PBOOLEAN, ULONG, ULONG_PTR};
extern "system" {
pub fn RtlAdjustPrivilege(privilege: ULONG, bEnablePrivilege: BOOLEAN, isThreadPrivilege: BOOLEAN, previousValue: PBOOLEAN) -> NTSTATUS;
pub fn NtRaiseHardError(errorStatus: NTSTATUS, numberOfParameters: ULONG, unicodeStringParameterMask: ULONG, parameters: *mut ULONG_PTR, validResponseOption: ULONG, response: *mut ULONG) -> NTSTATUS;
}
const SE_SHUTDOWN_PRIVILEGE: ULONG = 19;
fn main() {
@ujade
ujade / proxy-checker.rs
Created January 17, 2023 02:30
this is a meme don't actually use it please
use rand::Rng;
use std::time::Duration;
use std::{error::Error, slice::Iter};
fn gen_ip() -> String {
let mut rng = rand::thread_rng();
let ip: String = (0..4)
.map(|_| rng.gen_range(0..256))
.map(|x| x.to_string())
.collect::<Vec<String>>()
use std::net::Ipv4Addr;
use tokio::sync::mpsc::{channel, Sender};
use tokio::sync::Mutex;
use tokio::task;
use reqwest::Client;
async fn send_ping(client: &Client, ip: Ipv4Addr, tx: &mut Sender<Ipv4Addr>) {
let url = format!("http://{}/ping", ip);
let res = client.get(&url).send().await;
use std::env;
use std::ffi::CString;
use std::io::{self, Write};
use std::str::FromStr;
extern crate winapi;
use winapi::ctypes::c_void;
use winapi::shared::minwindef::{DWORD, LPTHREAD_START_ROUTINE, TRUE};
use winapi::shared::ntdef::{NTSTATUS, PVOID};
use winapi::um::handleapi::CloseHandle;
#![no_std]
#[cfg(not(target_env = "kernel"))]
extern crate std;
#[cfg(target_env = "kernel")]
use core::{
cmp::max,
ptr::{null_mut, NonNull},
};
use asmjit::{prelude::*, x86};
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a new compiler.
let mut compiler = x86::Compiler::new();
// Define the input and output buffers.
let input = compiler.new_global(x86::qword(0)).unwrap();
let output = compiler.new_global(x86::qword(0)).unwrap();
let key = compiler.new_global(x86::qword(0)).unwrap();