Skip to content

Commit 86c8805

Browse files
committed
commit
1 parent c42a38a commit 86c8805

3,454 files changed

Lines changed: 42481 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Cargo.lock

Lines changed: 318 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[package]
2+
name = "main"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
[dependencies]
7+
clap = { version = "4.0", features = ["derive"] }
8+
regex = "1"
9+
walkdir = "2"
10+
figlet-rs = "0.1.5"

src/main.rs

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
use clap::{Parser, Command};
2+
use regex::Regex;
3+
use walkdir::WalkDir;
4+
use std::io::{self, Read};
5+
use std::fs;
6+
use figlet_rs::FIGfont;
7+
8+
9+
mod reg;
10+
use reg::reg;
11+
12+
13+
#[derive(Parser, Debug)]
14+
#[command(author = "MorphyKutay", version = "1.0", about = "Python Vulnerable Scanner", long_about = None)]
15+
struct Args {
16+
17+
#[arg(short, long, help = "Path to the file to be processed")]
18+
path: String,
19+
20+
}
21+
22+
23+
24+
fn main()-> io::Result<()> {
25+
26+
let text = "Py Scanner";
27+
let figfont = FIGfont::standard().unwrap();
28+
let rendered = figfont.convert(text).unwrap();
29+
println!("{}", rendered);
30+
31+
let args = Args::parse();
32+
33+
let mut folder = args.path;
34+
35+
for entry in WalkDir::new(folder) {
36+
let entry = entry.unwrap();
37+
let dosya = entry.path();
38+
39+
if dosya.is_file() {
40+
if let Some(extension) = dosya.extension() {
41+
if extension == "py" {
42+
let contents = fs::read_to_string(dosya)?;
43+
println!("File: {}\nVulnerable Content:\n{}", dosya.display(), contents);
44+
45+
let pattern = reg();
46+
for cap in pattern.captures_iter(&contents) {
47+
println!("Vulnerable Function: {}", &cap[0]);
48+
}
49+
}
50+
}
51+
}
52+
}
53+
54+
55+
56+
57+
58+
Ok(())
59+
}

src/reg.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
use regex::Regex;
2+
3+
pub fn reg() -> Regex {
4+
Regex::new(r"\b(eval|exec|os\.system|subprocess\.(Popen|call)|open|pickle\.load)\b")
5+
.expect("Invalid regex pattern")
6+
}

0 commit comments

Comments
 (0)