Skip to content

This Repository is a collection of different ethical hacking tools and malware's for penetration testing and research purpose written in python, ruby, rust, c++, go and c.

Create CreateProcess.rs

Abdul Wahab Junaidd450f89bada1
diff --git a/Rust for Hacking/Basic/CreateProcess.rs b/Rust for Hacking/Basic/CreateProcess.rs
new file mode 100644
index 0000000..9130bfa
--- /dev/null
+++ b/Rust for Hacking/Basic/CreateProcess.rs
@@ -0,0 +1,25 @@
+// Pointer concept to understand
+
+
+fn main(){
+ let number = Arc::new(Mutex::new(0));
+ let my_number = Arc::clone(&number);
+ let my_number2 = Arc::clone(&number);
+
+ let thread1 = std::thread::spawn(move||{
+ for _ in 0..10{
+ *my_number.lock().unwrap() += 1;
+ }
+ });
+
+ let thread2 = std::thread::spawn(move ||{
+ for _ in 0..10{
+ *my_number2.lock().unwrap() += 1;
+ }
+ });
+
+ thread1.join().unwrap();
+ thread2.join().unwrap();
+ println!("Value is : {:?}",number);
+ println!("(+) Exiting...");
+}