-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c42a38a
commit 86c8805
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.
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
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" |
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,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(()) | ||
} |
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,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") | ||
} |
Oops, something went wrong.