mirror of
https://github.com/skerkour/black-hat-rust
synced 2026-06-08 17:29:34 +00:00
init
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
# rust
|
||||
target/
|
||||
**/*.rs.bk
|
||||
@@ -0,0 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to the book will be documented in this file.
|
||||
|
||||
## v2021.1 - 2021-02-03
|
||||
|
||||
### Added
|
||||
|
||||
* Chapter 01: Early access release
|
||||
@@ -0,0 +1,110 @@
|
||||
<p align="center">
|
||||
<a href="https://academy.kerkour.com/black-hat-rust" target="_blank" rel="noopener"><img alt="Black Hat Rust logo" src="./black_hat_rust_cover.png" height="300" /></a>
|
||||
<h1 align="center">Black Hat Rust - Early Access</h1>
|
||||
<h3 align="center">Deep dive into offensive security with the Rust programming language</h3>
|
||||
<h3 align="center">
|
||||
<a href="https://academy.kerkour.com/black-hat-rust">Buy the book now!</a>
|
||||
</h3>
|
||||
</p>
|
||||
|
||||
|
||||
## Summary
|
||||
|
||||
Whether it be in movies or in mainstream media, hackers are often romanticized: they are painted as black magic wizards, nasty criminals, or, in the worst cases, as thieves with a hood and a crowbar.
|
||||
In reality, the spectrum of the profile of the attackers is extremely large, from the bored teenager exploring the internet to sovereign State’s armies as well as the unhappy former employee.
|
||||
|
||||
What are the motivations of the attackers? How can they break seemingly so easily into any network? What do they do to their victims?
|
||||
We will put on our black hat and explore the arcanes of offensive security, whether it be cyber attacks, cybercrimes or cyberwar.
|
||||
Scanners, exploits, malwares... From theory to pratice, we build our own offensive tools at the edge of technology, with the Rust programming language, Stack Overflow’s most loved language for five years in a row. Rust is opening a new page in history of programming languages by providing unmatched guarantees and features, whether it be in defensive or, as we will see, offensive security.
|
||||
|
||||
Free Updates and DRM Free, of course :)
|
||||
|
||||
## Who this book is for
|
||||
|
||||
This is NOT a 1000th tutorial about sqlmap and Metasploit.
|
||||
|
||||
You will enjoy it if any of the following:
|
||||
|
||||
- You keep screaming "show me the code!" when reading about cyber attacks and malwares
|
||||
- You want to learn real-world and idiomatic rust practices
|
||||
- You want to make money with bug bounties or offensive security
|
||||
- You believe that the best defense is thinking like an attacker
|
||||
- You learn by building and love to look under the hood
|
||||
- You develop your own tools and exploits with Python, Ruby, C, Java...
|
||||
- You want to learn real-world offensive security, not just pentesting
|
||||
|
||||
|
||||
<h3>
|
||||
<a href="https://academy.kerkour.com/black-hat-rust">Buy the book now!</a>
|
||||
</h3>
|
||||
|
||||
## Early access
|
||||
|
||||
As of today, the book is still a work in progress. You can think of it as a Kickstarter campaign, but with 100% of the revenue going to the author.
|
||||
|
||||
If for any reason the project has to shut down before its completion, you'll receive a full refund.
|
||||
|
||||
estimated final publication: **June 2021**
|
||||
|
||||
estimated number of pages: **~320**
|
||||
|
||||
**In order to thanks the people who make it possible, all early access buyers will also receive the following bonus:**
|
||||
* **A curated list of advanced malware analyses**
|
||||
|
||||
|
||||
<h3>
|
||||
<a href="https://academy.kerkour.com/black-hat-rust">Buy the book now!</a>
|
||||
</h3>
|
||||
|
||||
## Table of contents
|
||||
|
||||
* 1: Introduction <span title="available">✅</span>
|
||||
|
||||
#### Part I: Reconnaissance
|
||||
|
||||
* 2: Multi-threaded attack surface discovery <span title="work in progress">🚧</span>
|
||||
* 3: Going full speed with async
|
||||
* 4: Adding modules with Trait objects
|
||||
* 5: Crawling the web for OSINT
|
||||
|
||||
|
||||
#### Part II: Exploitation
|
||||
|
||||
* 6: Finding vulnerabilities with Fuzzing
|
||||
* 7: Exploit development
|
||||
* 8: Writing shellcodes in Rust
|
||||
* 9: Phishing with WebAssembly
|
||||
|
||||
|
||||
#### Part III: Implant development
|
||||
|
||||
* 10: A modern RAT
|
||||
* 11: Securing communications with end-to-end encryption
|
||||
* 12: Going multi-platforms
|
||||
* 13: Turning into a worm to increase reach
|
||||
|
||||
|
||||
<h3>
|
||||
<a href="https://academy.kerkour.com/black-hat-rust">Buy the book now!</a>
|
||||
</h3>
|
||||
|
||||
|
||||
## Community
|
||||
|
||||
Hey! Welcome you to the Black Hat Rustaceans gang! If you think something in the book or the code can be improved, please [open an issue]((https://github.com/skerkour/black-hat-rust/issues)). Pull requests are also welcome :)
|
||||
|
||||
If you have any question or idea, feel free to [join the discusssion on the Forum](https://github.com/skerkour/black-hat-rust/discussions)!
|
||||
|
||||
|
||||
## Newsletter
|
||||
|
||||
Want to stay updated? I’ll write you once a week about avoiding complexity, hacking and entrepreneurship.
|
||||
|
||||
**https://kerkour.com/subscribe**
|
||||
|
||||
*I hate spam even more than you do. I'll never share your email and you can unsubscribe at anytime. Also there is no tracking or ads.*
|
||||
|
||||
|
||||
## Changelog
|
||||
|
||||
You'll find all the updates in the Changelog: https://github.com/skerkour/black-hat-rust/blob/main/CHANGELOG.md
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 346 KiB |
Generated
+86
@@ -0,0 +1,86 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
[[package]]
|
||||
name = "block-buffer"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4"
|
||||
dependencies = [
|
||||
"generic-array",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "cpuid-bool"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634"
|
||||
|
||||
[[package]]
|
||||
name = "digest"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066"
|
||||
dependencies = [
|
||||
"generic-array",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "generic-array"
|
||||
version = "0.14.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817"
|
||||
dependencies = [
|
||||
"typenum",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hex"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "644f9158b2f133fd50f5fb3242878846d9eb792e445c893805ff0e3824006e35"
|
||||
|
||||
[[package]]
|
||||
name = "opaque-debug"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
|
||||
|
||||
[[package]]
|
||||
name = "sha-1"
|
||||
version = "0.9.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ce3cdf1b5e620a498ee6f2a171885ac7e22f0e12089ec4b3d22b84921792507c"
|
||||
dependencies = [
|
||||
"block-buffer",
|
||||
"cfg-if",
|
||||
"cpuid-bool",
|
||||
"digest",
|
||||
"opaque-debug",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sha1_cracker"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"hex",
|
||||
"sha-1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "typenum"
|
||||
version = "1.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed"
|
||||
@@ -0,0 +1,11 @@
|
||||
[package]
|
||||
name = "sha1_cracker"
|
||||
version = "0.1.0"
|
||||
authors = ["Sylvain Kerkour <sylvain@kerkour.fr>"]
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
sha-1 = "0.9"
|
||||
hex = "0.4.2"
|
||||
@@ -0,0 +1,25 @@
|
||||
# SHA1 cracker
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
# sha1_cracker [wordlist.txt] [sha1_hash]
|
||||
# for example
|
||||
$ sha1_cracker wordlist.txt 7c6a61c68ef8b9b6b061b28c348bc1ed7921cb53
|
||||
# or
|
||||
$ sha1_cracker wordlist.txt 95401a269a87015f41c501aa2bfff8428713b848
|
||||
```
|
||||
|
||||
|
||||
## Run
|
||||
|
||||
```
|
||||
$ cargo run -- wordlist.txt 7c6a61c68ef8b9b6b061b28c348bc1ed7921cb53
|
||||
```
|
||||
|
||||
|
||||
## Build
|
||||
|
||||
```
|
||||
$ cargo build
|
||||
```
|
||||
@@ -0,0 +1,39 @@
|
||||
use sha1::Digest;
|
||||
use std::{
|
||||
env,
|
||||
error::Error,
|
||||
fs::File,
|
||||
io::{BufRead, BufReader},
|
||||
};
|
||||
|
||||
const SHA1_HEX_STRING_LENGTH: usize = 40;
|
||||
|
||||
fn main() -> Result<(), Box<dyn Error>> {
|
||||
let args: Vec<String> = env::args().collect();
|
||||
|
||||
if args.len() != 3 {
|
||||
println!("Usage:");
|
||||
println!("sha1_cracker: [wordlist.txt] [sha1_hash]");
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let hash_to_crack = args[2].trim();
|
||||
if hash_to_crack.len() != SHA1_HEX_STRING_LENGTH {
|
||||
return Err("sha1 hash is not valid".into());
|
||||
}
|
||||
|
||||
let wordlist_file = File::open(&args[1])?;
|
||||
let reader = BufReader::new(&wordlist_file);
|
||||
|
||||
for line in reader.lines() {
|
||||
let common_password = line?.trim().to_string();
|
||||
if hash_to_crack == &hex::encode(sha1::Sha1::digest(common_password.as_bytes())) {
|
||||
println!("Password found: {}", &common_password);
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
|
||||
println!("password not found in wordlist :(");
|
||||
// as almost everything is an expression, this is equivalent to return Ok(());
|
||||
Ok(())
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Generated
+5
@@ -0,0 +1,5 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
[[package]]
|
||||
name = "enums"
|
||||
version = "0.1.0"
|
||||
@@ -0,0 +1,9 @@
|
||||
[package]
|
||||
name = "enums"
|
||||
version = "0.1.0"
|
||||
authors = ["Sylvain Kerkour <sylvain@kerkour.fr>"]
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
@@ -0,0 +1,12 @@
|
||||
pub enum Status {
|
||||
Queued,
|
||||
Running,
|
||||
Failed,
|
||||
}
|
||||
|
||||
pub fn print_status(status: Status) {
|
||||
match status {
|
||||
Status::Queued => println!("queued"),
|
||||
Status::Running => println!("running"),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user