File tree Expand file tree Collapse file tree 3 files changed +15
-4
lines changed
Expand file tree Collapse file tree 3 files changed +15
-4
lines changed Original file line number Diff line number Diff line change 11[package ]
22name = " ulexec"
3- version = " 0.0.7 "
3+ version = " 0.0.8 "
44edition = " 2021"
55license = " MIT"
66readme = " README.md"
Original file line number Diff line number Diff line change 11# Maintainer: VHSgunzo <vhsgunzo.github.io>
22pkgname=' ulexec-bin'
33binname=" ${pkgname% -bin} "
4- pkgver=' 0.0.7 '
4+ pkgver=' 0.0.8 '
55pkgrel=' 1'
66pkgdesc=' A tool for loading and executing PE on Windows and ELF on Linux from memory'
77arch=(" x86_64" )
Original file line number Diff line number Diff line change @@ -277,7 +277,6 @@ fn main() {
277277 #[ cfg( target_os = "linux" ) ]
278278 {
279279 use std:: time;
280- use std:: process;
281280 use std:: fs:: File ;
282281 use std:: ffi:: CString ;
283282 use std:: os:: fd:: AsRawFd ;
@@ -305,6 +304,18 @@ fn main() {
305304 }
306305 }
307306
307+ fn random_string ( length : usize ) -> String {
308+ const CHARSET : & [ u8 ] = b"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" ;
309+ let mut rng = time:: SystemTime :: now ( ) . duration_since ( time:: UNIX_EPOCH ) . unwrap ( ) . as_secs ( ) ;
310+ let mut result = String :: with_capacity ( length) ;
311+ for _ in 0 ..length {
312+ rng = rng. wrapping_mul ( 48271 ) . wrapping_rem ( 0x7FFFFFFF ) ;
313+ let idx = ( rng % CHARSET . len ( ) as u64 ) as usize ;
314+ result. push ( CHARSET [ idx] as char ) ;
315+ }
316+ result
317+ }
318+
308319 fn ul_exec ( file_path : PathBuf , exec_args : Vec < String > ) {
309320 let mut args_cstrs: Vec < CString > = exec_args. iter ( )
310321 . map ( |arg|
@@ -329,7 +340,7 @@ fn main() {
329340 }
330341
331342 if args. reexec && !is_child && !args. mfdexec {
332- let fifo_path = & env:: temp_dir ( ) . join ( process :: id ( ) . to_string ( ) ) ;
343+ let fifo_path = & env:: temp_dir ( ) . join ( random_string ( 8 ) ) ;
333344 if let Err ( err) = mkfifo ( fifo_path, Mode :: S_IRWXU ) {
334345 eprintln ! ( "Failed to create fifo: {err}: {:?}" , fifo_path) ;
335346 exit ( 1 )
You can’t perform that action at this time.
0 commit comments