diff --git a/README.md b/README.md index 64b4562..2bac4dc 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,28 @@ # theKadeshi # ### Antivirus for your web-site ### [![Code Issues](https://www.quantifiedcode.com/api/v1/project/40bbe4ed3bdf46af9107edcea02e9d22/badge.svg)](https://www.quantifiedcode.com/app/project/40bbe4ed3bdf46af9107edcea02e9d22) +[TOC] +#### Usage #### +Download latest version from release section: [Releases](https://github.com/theKadeshi/theKadeshi.py/releases) + +Unpack the .zip file. + #### Options #### +Source code startup: ```bash -python kadeshi.py [options] /home/name/your-site-folder/ +python kadeshi.py [options] /home/name/your_site_folder/ ``` +Windows binaries: +```powershell +kadeshi.exe [options] c:\temp\sites\your_site_folder\ +``` +Options are: + * `-h` - Help * `-v` - Version -* `-nc` - Disable color output +* `-bw` - Disable color output * `-nh` - Disable heuristic detection +* `-nc` - Disable cleanup mode #### Requirements #### * Python 3.6+ diff --git a/kadeshi.py b/kadeshi.py index 622b2d2..d2865ae 100644 --- a/kadeshi.py +++ b/kadeshi.py @@ -15,14 +15,19 @@ parser.add_argument( "-nc", "--no-color", action='store_true', - help="Disable color output" + help="Disable color output. Enabled by default" ) parser.add_argument( "-nh", "--no-heuristic", action="store_true", - help="Disable heuristic detection. Check all files" + help="Disable heuristic detection. Check all files. Enabled by default" ) - parser.add_argument('-v', '--version', action='version', version='%(prog)s 0.0.1') + parser.add_argument( + "-dc", "--no-cure", + action="store_true", + help="Disable malware cleanup. Enabled by default" + ) + parser.add_argument('-v', '--version', action='version', version='%(prog)s 0.0.9') args = parser.parse_args() diff --git a/modules/thekadeshi.py b/modules/thekadeshi.py index fd4b4a0..5bfd366 100644 --- a/modules/thekadeshi.py +++ b/modules/thekadeshi.py @@ -44,6 +44,9 @@ def __init__(self, arguments): self.site_folder: str = arguments.site self.no_color: bool = arguments.no_color self.no_heuristic: bool = arguments.no_heuristic + self.no_cure: bool = arguments.no_cure + + print(self.no_cure) def get_files_list(self): """ @@ -242,30 +245,39 @@ def cure(self): # Удаление зараженного файла if element['action'] == 'delete': try: - os.remove(element['path']) - cure_result['result'] = 'ok' + if not self.no_cure: + os.remove(element['path']) + cure_result['result'] = 'ok' + else: + cure_result['result'] = 'disabled' except PermissionError as e: cure_result['result'] = 'false' cure_result['result_message'] = e # Лечение зараженного файла if element['action'] == 'cure': - file_content = fs.get_file_content(element['path']) - cure_result['result'] = 'cure' - first_part: bytes = file_content[:element['cure']['start']] - second_part: bytes = file_content[element['cure']['end']:] - - result = fs.put_file_content(element['path'], first_part + second_part) - cure_result['result'] = 'false' - if result: - cure_result['result'] = 'ok' + if not self.no_cure: + file_content = fs.get_file_content(element['path']) + cure_result['result'] = 'cure' + first_part: bytes = file_content[:element['cure']['start']] + second_part: bytes = file_content[element['cure']['end']:] + + result = fs.put_file_content(element['path'], first_part + second_part) + cure_result['result'] = 'false' + if result: + cure_result['result'] = 'ok' + else: + cure_result['result'] = 'disabled' if element['action'] == 'quarantine': - try: - os.rename(element['path'], element['path'] + '.suspected') - except PermissionError as e: - cure_result['result'] = 'false' - cure_result['result_message'] = e + if not self.no_cure: + try: + os.rename(element['path'], element['path'] + '.suspected') + except PermissionError as e: + cure_result['result'] = 'false' + cure_result['result_message'] = e + else: + cure_result['result'] = 'disabled' rpt.append(cure_result) diff --git a/setup.py b/setup.py index 7c6cc9a..e0ddbc1 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ setup( name='theKadeshi', - version='0.0.8', + version='0.0.9', url='https://thekadeshi.com', license='MIT', author='theKadeshi',