Skip to content

Commit

Permalink
Merge pull request #13 from LimesKey/main
Browse files Browse the repository at this point in the history
Gather user's system GPU specs
  • Loading branch information
LimesKey authored Oct 2, 2023
2 parents d773aeb + a494c2e commit 1750497
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 10 deletions.
37 changes: 30 additions & 7 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,50 @@ name: Rust

on:
push:
branches: [ "main" ]
branches: [ "main", "master", "GPU-MD5-Crack" ]
pull_request:
branches: [ "main" ]
branches: [ "main", "master", "GPU-MD5-Crack" ]

env:
CARGO_TERM_COLOR: always

jobs:
build:

runs-on: windows-latest

runs-on: ubuntu-latest

steps:
- name: Load OpenCL
run: |
wget -qO - https://repositories.intel.com/graphics/intel-graphics.key |
sudo apt-key add -
sudo add-apt-repository \
'deb [arch=amd64] https://repositories.intel.com/graphics/ubuntu focal main'
sudo apt-get update
sudo apt-get install \
intel-opencl-icd \
intel-level-zero-gpu level-zero \
intel-media-va-driver-non-free libmfx1
sudo apt-get install ocl-icd-opencl-dev
- uses: actions/checkout@v3
- name: Build
run: cargo build --verbose

test:
runs-on: ubuntu-latest

steps:
- name: Load OpenCL
run: |
wget -qO - https://repositories.intel.com/graphics/intel-graphics.key |
sudo apt-key add -
sudo add-apt-repository \
'deb [arch=amd64] https://repositories.intel.com/graphics/ubuntu focal main'
sudo apt-get update
sudo apt-get install \
intel-opencl-icd \
intel-level-zero-gpu level-zero \
intel-media-va-driver-non-free libmfx1
sudo apt-get install ocl-icd-opencl-dev
- uses: actions/checkout@v3
- name: Run tests
run: cargo test --verbose
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ rpassword = "7.2"
tokio = { version = "1.28.2", features = ["full"] }
pwned = { git = "https://github.com/wisespace-io/pwned-rs.git" }
parselnk = "0.1.1"
regex = "1.9.5"
regex = "1.9.5"
opencl3 = "0.9.3"
Binary file modified PasswordLLM-64x.exe
Binary file not shown.
49 changes: 49 additions & 0 deletions src/gpu/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#[allow(non_snake_case)]

pub mod gpu {
use opencl3::device::{get_all_devices, CL_DEVICE_TYPE_GPU};
use std::io;
pub fn obtainGPU() -> Result<(), ()> {
let devices: Vec<*mut std::ffi::c_void> = get_all_devices(CL_DEVICE_TYPE_GPU).expect("Cannot detect a GPU!");
let mut gpu_choice: u32 = 0;

if devices.len() > 1 {
loop {
println!("You have multiple ({}) GPUs, please select one!", devices.len());
for gpu in 0..devices.len() {
let device = devices[gpu];
let device = opencl3::device::Device::new(device);
println!("\tGPU Device {}: {}", gpu, device.name().unwrap());
}
print!("Selection: ");

let mut tree = String::new();
io::stdin().read_line(&mut tree).expect("Failed to read line");
let water = tree.trim();

match water.parse::<u32>() {
Ok(_) => {
gpu_choice = water.parse().unwrap();
if gpu_choice > devices.len() as u32 {
panic!("Please select a valid GPU!")
}
break;
}
Err(_) => {
println!("Please type a number!");
}
}
}
}
println!("You have selected GPU Device {}", gpu_choice);
let gpu = opencl3::device::Device::new(devices[gpu_choice as usize]);

println!("Your {} has {} CUDA cores and {} stream multiprocessors", gpu.name().unwrap(), gpu.max_compute_units().unwrap(), (gpu.max_compute_units().unwrap() * 8));
//println!("Device: {:?}", device.name());
//println!("Device: {:?}", device.vendor());
//println!("Device: {:?}", device.version());
//println!("Device: {:?}", device.driver_version());
//println!("MAx compute units: {:?}", device.max_compute_units());
Ok(())
}
}
9 changes: 7 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@

mod tests;
mod utils;
mod gpu;

use utils::pwned_api::pass_check;
use gpu::gpu::obtainGPU;

use std::env;
use std::fs::File;
use std::path::Path;
use utils::pwned_api::pass_check;
use round::round;
use std::fs;
use std::io::{BufRead, BufReader};
Expand All @@ -28,6 +32,7 @@ pub async fn main() {
let pool_size = get_pool_size(password.clone());
let entropy = calculate_entropy(pool_size); // calls functions
let alphabet_match = regex_match(password.clone());
obtainGPU(); // todo

check_if_pwned(password.clone()).await;

Expand Down Expand Up @@ -172,7 +177,7 @@ async fn password_list(password: String) -> Result<bool, ()> {
tokio::time::sleep(Duration::from_secs(1)).await;
}
}
if line >= 2459760 {
if line >= 2459760 { // if it's at the end of the file, stop the search and return password not found
return Ok(false);
}
}
Expand Down

0 comments on commit 1750497

Please sign in to comment.