mirror of
https://github.com/epi052/feroxbuster.git
synced 2026-06-08 02:31:16 -03:00
merged in master and tokio1.0 branch
This commit is contained in:
@@ -26,11 +26,18 @@ use std::{
|
||||
time::{SystemTime, UNIX_EPOCH},
|
||||
};
|
||||
use std::{
|
||||
io::{stderr, Write},
|
||||
io::{stderr, stdout, Write},
|
||||
sync::atomic::{AtomicBool, AtomicUsize, Ordering},
|
||||
};
|
||||
use tokio::{task::JoinHandle, time};
|
||||
use uuid::Uuid;
|
||||
// todo do i need this 107
|
||||
use crossterm::style::Print;
|
||||
use crossterm::{
|
||||
cursor::{Hide, MoveTo, Show},
|
||||
execute, queue,
|
||||
terminal::{enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen},
|
||||
};
|
||||
|
||||
lazy_static! {
|
||||
/// A clock spinner protected with a RwLock to allow for a single thread to use at a time
|
||||
@@ -108,8 +115,8 @@ impl FeroxScan {
|
||||
pub fn abort(&self) {
|
||||
self.stop_progress_bar();
|
||||
|
||||
if let Some(_task) = &self.task {
|
||||
// task.abort(); todo uncomment once upgraded to tokio 0.3 (issue #107)
|
||||
if let Some(task) = &self.task {
|
||||
task.abort();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -347,12 +354,28 @@ impl FeroxScans {
|
||||
/// 9: complete https://10.129.45.20/images
|
||||
/// 10: complete https://10.129.45.20/assets
|
||||
pub fn display_scans(&self) {
|
||||
// todo #107: trying to figure out a way to display these without the terminal going batshit
|
||||
// i think what likely needs to happen is that the terminal thread needs to be paused
|
||||
// as well, so that returning responses arent shown. clear the screen, get the input, act
|
||||
// accordingly, and then unpause everything. i.e. pinch the hose and then let it go
|
||||
let mut writer = stdout();
|
||||
queue!(writer, EnterAlternateScreen, Hide).unwrap();
|
||||
|
||||
if let Ok(scans) = self.scans.lock() {
|
||||
let mut y = 1;
|
||||
for (i, scan) in scans.iter().enumerate() {
|
||||
if let Ok(unlocked_scan) = scan.lock() {
|
||||
match unlocked_scan.scan_type {
|
||||
ScanType::Directory => {
|
||||
PROGRESS_PRINTER.println(format!("{:3}: {}", i, unlocked_scan));
|
||||
queue!(
|
||||
writer,
|
||||
MoveTo(1, y),
|
||||
Print(format!("{:3}: {}", i, unlocked_scan))
|
||||
)
|
||||
.unwrap();
|
||||
writer.flush().unwrap();
|
||||
y += 1;
|
||||
// PROGRESS_PRINTER.println(format!("{:3}: {}", i, unlocked_scan));
|
||||
}
|
||||
ScanType::File => {
|
||||
// we're only interested in displaying directory scans, as those are
|
||||
@@ -362,6 +385,8 @@ impl FeroxScans {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
execute!(writer, LeaveAlternateScreen, Show).unwrap();
|
||||
}
|
||||
|
||||
/// Forced the calling thread into a busy loop
|
||||
|
||||
@@ -550,9 +550,7 @@ pub async fn scan_url(
|
||||
// for every word in the wordlist, check to see if PAUSE_SCAN is set to true
|
||||
// when true; enter a busy loop that only exits by setting PAUSE_SCAN back
|
||||
// to false
|
||||
|
||||
// todo change to true when issue #107 is resolved
|
||||
SCANNED_URLS.pause(false).await;
|
||||
SCANNED_URLS.pause(true).await;
|
||||
}
|
||||
make_requests(&tgt, &word, base_depth, txd, txr).await
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user