-
-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new: added socks5 plugin (closes #26)
- Loading branch information
1 parent
3082cd4
commit c963c7f
Showing
7 changed files
with
96 additions
and
2 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
use std::time::Duration; | ||
|
||
use async_trait::async_trait; | ||
use ctor::ctor; | ||
|
||
use crate::session::{Error, Loot}; | ||
use crate::utils; | ||
use crate::Options; | ||
use crate::Plugin; | ||
|
||
use crate::creds::Credentials; | ||
|
||
#[ctor] | ||
fn register() { | ||
crate::plugins::manager::register("socks5", Box::new(Socks5::new())); | ||
} | ||
|
||
#[derive(Clone)] | ||
pub(crate) struct Socks5 {} | ||
|
||
impl Socks5 { | ||
pub fn new() -> Self { | ||
Socks5 {} | ||
} | ||
} | ||
|
||
#[async_trait] | ||
impl Plugin for Socks5 { | ||
fn description(&self) -> &'static str { | ||
"SOCKS5 password authentication." | ||
} | ||
|
||
fn setup(&mut self, _opts: &Options) -> Result<(), Error> { | ||
Ok(()) | ||
} | ||
|
||
async fn attempt(&self, creds: &Credentials, timeout: Duration) -> Result<Option<Loot>, Error> { | ||
let address: String = utils::parse_target_address(&creds.target, 1080)?; | ||
let res = tokio::time::timeout( | ||
timeout, | ||
fast_socks5::client::Socks5Stream::connect_with_password( | ||
address.clone(), | ||
"ifcfg.co".to_owned(), | ||
80, | ||
creds.username.clone(), | ||
creds.password.clone(), | ||
fast_socks5::client::Config::default(), | ||
), | ||
) | ||
.await | ||
.map_err(|e| e.to_string())?; | ||
|
||
return Ok(if res.is_ok() { | ||
Some(Loot::new( | ||
"socks5", | ||
&address, | ||
[ | ||
("username".to_owned(), creds.username.to_owned()), | ||
("password".to_owned(), creds.password.to_owned()), | ||
], | ||
)) | ||
} else { | ||
None | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
docker run \ | ||
--security-opt no-new-privileges \ | ||
--name socks5 \ | ||
--restart unless-stopped \ | ||
-p 1080:1080 \ | ||
-e PROXY_USER=admin666 \ | ||
-e PROXY_PASSWORD=test12345 \ | ||
yarmak/socks5-server |