This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::collections::HashMap; | |
| #[derive(Clone)] | |
| struct SpeciesData { | |
| id: u32, | |
| name: String, | |
| base_hp: u32, | |
| base_attack: u32, | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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>>() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #![no_std] | |
| #[cfg(not(target_env = "kernel"))] | |
| extern crate std; | |
| #[cfg(target_env = "kernel")] | |
| use core::{ | |
| cmp::max, | |
| ptr::{null_mut, NonNull}, | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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(); |
NewerOlder