Skip to content

Commit

Permalink
e
Browse files Browse the repository at this point in the history
  • Loading branch information
exersalza committed May 26, 2024
1 parent 6622e5f commit 72203c0
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 36 deletions.
31 changes: 0 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@
<img src="https://profile-counter.glitch.me/FivemCipherFinder/count.svg" />
</div>

[![Pylint and Flake8](https://github.com/exersalza/FivemCipherFinder/actions/workflows/pylint.yml/badge.svg)](https://github.com/exersalza/FivemCipherFinder/actions/workflows/pylint.yml)
[![PyTest](https://github.com/exersalza/FivemCipherFinder/actions/workflows/pytest.yml/badge.svg)](https://github.com/exersalza/FivemCipherFinder/actions/workflows/pytest.yml)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
![](https://tokei.rs/b1/github/exersalza/fivemcipherfinder)
![PyPI - Downloads](https://img.shields.io/pypi/dm/fivemcipherfinder?label=pypi%20downloads)


- [Installation](#installation)
- [Usage](#Usage)
Expand All @@ -28,31 +22,6 @@ FivemCipherFinder is a tool designed to assist in the removal of Ciphers from yo

## Installation

To install FivemCipherFinder, follow these steps:
INSTALL PYTHON FROM THIS [TUTORIAL](https://phoenixnap.com/kb/how-to-install-python-3-windows)
PLEASE MAKE SURE TO CHECK THOSE CHECKBOXES
![img_2.png](img_2.png)

### New version
Get the `install.ps1` script and run it, it'll do anything for you, you just have to run the finder by itself afterward. For more information press [here](POWERSHELL_INSTALL.md)

### Old Version
1. Make sure you have Python 3.8 or above installed on your system. If not, you can download the latest version of Python from the official website [here](https://python.org/downloads/).

2. Open your command prompt or terminal and run the following command to install FivemCipherFinder using pip:
```
pip install FivemCipherFinder
```

Alternatively, you can download the latest release of FivemCipherFinder from the GitHub repository [here](https://github.com/exersalza/FivemCipherFinder/releases) and unpack it manually.
1. Clone the Repo with one of those 2 commands: `git clone https://github.com/exersalza/FivemCipherFinder` or `git clone git@github.com:exersalza/FivemCipherFinder`
2. Change into the directory you just cloned with: `cd FivemCipherFinder`
3. To build and run use this Command: `python3 -m build . && pip install . --user`. Alternatively create a local venv to not interfere with other project dependencies: `python3 -m venv venv`. You can activate it with `.\venv\Scripts\activate.bat` on Windows or `source venv/bin/activate` on unix-like systems.

**Note:** If you are using a Windows-based system, make sure you have added Python to your environment variables. You can test this by typing `python --version` into your command prompt or terminal. If Python is not recognized, you may need to add it to your system's PATH variable. You can find instructions on how to do this [here](https://www.architectryan.com/2018/03/17/add-to-the-path-on-windows-10/).

3. Once installed, you can use the `find-cipher` command in your server's resources directory to start using FivemCipherFinder.

## Usage

To use FivemCipherFinder, you can run the `find-cipher` command with various options. Here are the available options:
Expand Down
10 changes: 7 additions & 3 deletions cipher_finder/src/file_op.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::io::Read;
use std::{fs, path::PathBuf};

use crate::utils::{check_regex, CIPHER_REGEX, SIMPLE_URL_REGEX};
use crate::utils::{self, check_regex, ScanLevel, CIPHER_REGEX, SIMPLE_URL_REGEX};

pub struct ScannedFile {
path: PathBuf,
Expand Down Expand Up @@ -35,22 +35,26 @@ impl ScannedFile {
/// Scans file
fn scan_file(&mut self) -> std::io::Result<()> {
let contents = self.get_file_contents()?;
let _scan_mode = match utils::SCAN_LEVEL.try_lock() {
Ok(v) => v.clone(),
Err(_) => ScanLevel::Standard,
};

for (ln, line) in contents.into_iter().enumerate() {
if line.contains('\n') {
continue;
}

let line = line.as_str();

//todo implement modes here somehow
self.add_infected(ln, check_regex(&CIPHER_REGEX, line));
self.add_infected(ln, check_regex(&SIMPLE_URL_REGEX, line));
}

Ok(())
}

/// Add infected lines to the lister
/// add infected lines to the lister
fn add_infected(&mut self, ln: usize, trigger: Vec<String>) {
if trigger.is_empty() {
return;
Expand Down
14 changes: 13 additions & 1 deletion cipher_finder/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,25 @@ struct Args {
/// Paht to the Directory where your server is located
path: String,

#[clap(short = 'e', long = "exclude", default_value = "")]
#[clap(short = 'x', long = "exclude", default_value = "")]
/// Exclude given Paths from Search. Syntax: foo,bar,foobar
exclude: String,

#[clap(long = "include-git", default_value = "false")]
/// includes content of .gitignore files. Maybe increases the time it needs to filter out files
include_git: bool,

/// Prevents logs from being created
#[clap(short = 'n', long = "no-log", default_value = "false")]
no_log: bool,

/// Prints some information
#[clap(short = 'v', default_value = "false")]
simple_verbose: bool,

/// Prints even more information
#[clap(long = "verbose", default_value = "false")]
verbose: bool,
}

fn main() -> std::io::Result<()> {
Expand Down
2 changes: 1 addition & 1 deletion cipher_finder/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ lazy_static! {
/// Defines the Scanlevel
/// Standard -> Uses the default regexes -> URL, HexCode
/// Aggressive -> Uses more regexes, but yields more false positives -> Lua IO Operations
#[derive(clap::ValueEnum, Debug, Clone)]
#[derive(clap::ValueEnum, Debug, Clone, PartialEq)]
pub enum ScanLevel {
/// Standard scan
Standard,
Expand Down

0 comments on commit 72203c0

Please sign in to comment.