Skip to content

Commit 2209637

Browse files
author
vsilent
committed
rustscan, openssl binaries added
1 parent 97b6a76 commit 2209637

File tree

7 files changed

+34
-21
lines changed

7 files changed

+34
-21
lines changed

VERSION.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.0.1

docker-compose.dev.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: '3'
22
services:
33
stackdog:
4-
container_name: backend
4+
container_name: stackdog
55
build:
66
context: .
77
dockerfile: docker/dev/Dockerfile

docker-compose.prod.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: '3'
22
services:
33
stackdog:
4-
container_name: backend
4+
container_name: stackdog
55
image: trydirect/stackdog
66
restart: always
77
ports:

docker-compose.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ volumes:
44
driver: local
55
services:
66
stackdog:
7-
container_name: backend
7+
container_name: stackdog
88
# image: trydirect/stackdog:latest
99
build:
1010
context: .
@@ -17,4 +17,7 @@ services:
1717
env_file: .env
1818
volumes:
1919
- db:/app/db
20-
20+
- ./.env:/app/.env:r
21+
environment:
22+
- RUST_LOG=debug
23+
- RUST_BACKTRACE=1

docker/local/Dockerfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,17 @@ RUN rm -rf ./target/release/deps/stackdog*; \
2929

3030

3131
# deploy stage
32-
FROM debian:buster-slim
32+
FROM debian:bookworm-slim
3333

3434
# create app directory
3535
WORKDIR /app
3636

3737
# install libpq
3838
RUN apt-get update; \
39-
apt-get install --no-install-recommends -y libpq-dev sqlite3 libsqlite3-dev; \
39+
apt-get install --no-install-recommends -y libpq-dev sqlite3 libsqlite3-dev openssl; \
4040
rm -rf /var/lib/apt/lists/*
4141

42-
from rustscan/rustscan:latest as rustscan
43-
COPY --from=rustscan /app/rustscan/target/release/rustscan /usr/local/bin/rustscan
42+
COPY --from=rustscan/rustscan:latest /usr/local/bin/rustscan /usr/local/bin/
4443

4544
# copy binary and configuration files
4645
COPY --from=build /app/target/release/stackdog .

src/api/scan_controller.rs

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,54 @@ use std::process::Command;
22
use tracing;
33

44
use crate::{config::db::Pool, constants, models::{
5-
user::{LoginDTO},
5+
scan::{IP, Domain},
66
response::ResponseBody,
77
}};
88
use actix_web::{web, HttpRequest, HttpResponse, Result};
99

10-
pub async fn scan_online(req: HttpRequest) -> Result<HttpResponse> {
10+
pub async fn scan_online(ip: web::Json<IP>) -> Result<HttpResponse> {
1111

12-
debug!("req: {:?}", req);
12+
// println!("ip: {:?}", ip.ip);
13+
let ip:&str = ip.ip.as_ref();
1314

1415
let output =
15-
Command::new("ls")
16-
.arg("-l")
17-
.arg("-a")
16+
Command::new("/usr/local/bin/rustscan")
17+
.arg(format!("-a {}", ip))
18+
.arg("--accessible")
19+
.arg("--ulimit 5000")
20+
.arg("--ports 443,80,8080,8000,5000,3000")
1821
.output()
19-
.expect("ls command failed to start");
22+
.expect("command failed to start");
23+
2024
debug!("status: {:?}", output.status);
2125
debug!("stdout: {:?}", String::from_utf8_lossy(&output.stdout));
2226
debug!("stderr: {:?}", String::from_utf8_lossy(&output.stderr));
2327

2428
let response = String::from_utf8_lossy(&output.stdout).to_string();
29+
println!("stderr response: {:?}", &output.stderr);
30+
println!("stdout response: {:?}", response);
2531
Ok(HttpResponse::Ok().json(ResponseBody::new(constants::EMPTY, response)))
2632

2733
}
2834

29-
pub async fn scan_ssl(req: HttpRequest) -> Result<HttpResponse> {
35+
pub async fn scan_ssl(domain: web::Json<Domain>) -> Result<HttpResponse> {
3036

31-
debug!("req: {:?}", req);
37+
// debug!("req: {:?}", req);
3238

3339
let output =
34-
Command::new("ls")
35-
.arg("-l")
36-
.arg("-a")
40+
Command::new("/usr/bin/openssl")
41+
.arg("s_client")
42+
.arg("-connect")
43+
.arg(format!("{}:443", domain.name))
3744
.output()
38-
.expect("ls command failed to start");
45+
.expect("command failed to start");
3946

4047
debug!("status: {:?}", output.status);
4148
debug!("stdout: {:?}", String::from_utf8_lossy(&output.stdout));
4249
debug!("stderr: {:?}", String::from_utf8_lossy(&output.stderr));
4350

4451
let response = String::from_utf8_lossy(&output.stdout).to_string();
52+
println!("stderr response: {:?}", &output.stderr);
53+
println!("stdout response: {:?}", response);
4554
Ok(HttpResponse::Ok().json(ResponseBody::new(constants::EMPTY, response)))
4655
}

src/models/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ pub mod response;
22
pub mod user;
33
pub mod user_token;
44
pub mod docker;
5+
pub(crate) mod scan;

0 commit comments

Comments
 (0)