Skip to content

Commit

Permalink
commit
Browse files Browse the repository at this point in the history
  • Loading branch information
MorphyKutay committed Aug 19, 2024
1 parent c42a38a commit 86c8805
Show file tree
Hide file tree
Showing 3,454 changed files with 42,481 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
318 changes: 318 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[package]
name = "main"
version = "0.1.0"
edition = "2021"

[dependencies]
clap = { version = "4.0", features = ["derive"] }
regex = "1"
walkdir = "2"
figlet-rs = "0.1.5"
59 changes: 59 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
use clap::{Parser, Command};
use regex::Regex;
use walkdir::WalkDir;
use std::io::{self, Read};
use std::fs;
use figlet_rs::FIGfont;


mod reg;
use reg::reg;


#[derive(Parser, Debug)]
#[command(author = "MorphyKutay", version = "1.0", about = "Python Vulnerable Scanner", long_about = None)]
struct Args {

#[arg(short, long, help = "Path to the file to be processed")]
path: String,

}



fn main()-> io::Result<()> {

let text = "Py Scanner";
let figfont = FIGfont::standard().unwrap();
let rendered = figfont.convert(text).unwrap();
println!("{}", rendered);

let args = Args::parse();

let mut folder = args.path;

for entry in WalkDir::new(folder) {
let entry = entry.unwrap();
let dosya = entry.path();

if dosya.is_file() {
if let Some(extension) = dosya.extension() {
if extension == "py" {
let contents = fs::read_to_string(dosya)?;
println!("File: {}\nVulnerable Content:\n{}", dosya.display(), contents);

let pattern = reg();
for cap in pattern.captures_iter(&contents) {
println!("Vulnerable Function: {}", &cap[0]);
}
}
}
}
}





Ok(())
}
6 changes: 6 additions & 0 deletions src/reg.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
use regex::Regex;

pub fn reg() -> Regex {
Regex::new(r"\b(eval|exec|os\.system|subprocess\.(Popen|call)|open|pickle\.load)\b")
.expect("Invalid regex pattern")
}
Loading

0 comments on commit 86c8805

Please sign in to comment.