Skip to content

Commit 443337d

Browse files
committed
v0.0.4
1 parent b0d4723 commit 443337d

File tree

4 files changed

+28
-38
lines changed

4 files changed

+28
-38
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ulexec"
3-
version = "0.0.3"
3+
version = "0.0.4"
44
edition = "2021"
55
license = "MIT"
66
readme = "README.md"

PKGBUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Maintainer: VHSgunzo <vhsgunzo.github.io>
22
pkgname='ulexec-bin'
33
binname="${pkgname%-bin}"
4-
pkgver='0.0.3'
4+
pkgver='0.0.4'
55
pkgrel='1'
66
pkgdesc='A tool for loading and executing PE on Windows and ELF on Linux from memory'
77
arch=("x86_64")

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@ You can have it read a binary from `stdin` if you specify `-s | --stdin` argumen
5353
cat /bin/ls|ulexec -s -- -lha
5454
# or
5555
ulexec -s</bin/ls -- -lha
56-
# or
57-
ulexec</bin/ls -- -lha
58-
# or
59-
cat /bin/ls|ulexec -- -lha
6056
```
6157

6258
To download a binary into memory and immediately execute it you can use `-u | --url`

src/main.rs

Lines changed: 26 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::env;
44
use std::fs::read;
55
use std::path::PathBuf;
66
use std::process::exit;
7-
use std::io::{self, IsTerminal, Read};
7+
use std::io::{self, Read};
88

99
use clap::Parser;
1010
use reqwest::blocking::{Client, RequestBuilder};
@@ -59,40 +59,34 @@ fn main() {
5959
let mut exec_file: Vec<u8> = Vec::new();
6060
let mut file_path = PathBuf::new();
6161

62-
if !io::stdin().is_terminal()
63-
&& (io::stderr().is_terminal() || io::stdout().is_terminal() || args.stdin) {
64-
args.stdin = true;
62+
if args.stdin {
6563
io::stdin().lock().read_to_end(&mut exec_file).unwrap();
66-
} else {
67-
if args.url.is_some() {
68-
let client = Client::builder();
69-
70-
#[cfg(target_os = "windows")]
71-
let client = client.use_rustls_tls();
72-
73-
let client = client
74-
.danger_accept_invalid_certs(true)
75-
.timeout(None)
76-
.build()
77-
.unwrap();
78-
79-
let req: RequestBuilder;
80-
let url = args.url.as_ref().unwrap();
81-
if args.post {
82-
req = client.post(url)
83-
} else {
84-
req = client.get(url)
85-
}
86-
exec_file = req.send().unwrap().bytes().unwrap().to_vec();
87-
drop(client)
64+
} else if args.url.is_some() {
65+
let client = Client::builder();
66+
67+
#[cfg(target_os = "windows")]
68+
let client = client.use_rustls_tls();
69+
70+
let client = client
71+
.danger_accept_invalid_certs(true)
72+
.timeout(None)
73+
.build()
74+
.unwrap();
75+
76+
let req: RequestBuilder;
77+
let url = args.url.as_ref().unwrap();
78+
if args.post {
79+
req = client.post(url)
8880
} else {
89-
if args.exec_args.is_empty() {
90-
eprintln!("Specify the path to the binary file!");
91-
exit(1)
92-
} else {
93-
file_path = PathBuf::from(args.exec_args.remove(0))
94-
}
81+
req = client.get(url)
9582
}
83+
exec_file = req.send().unwrap().bytes().unwrap().to_vec();
84+
drop(client)
85+
} else if !args.exec_args.is_empty() {
86+
file_path = PathBuf::from(args.exec_args.remove(0));
87+
} else {
88+
eprintln!("Specify the path to the binary file!");
89+
exit(1)
9690
}
9791

9892
if !file_path.to_str().unwrap().is_empty() && exec_file.is_empty() {

0 commit comments

Comments
 (0)