Skip to content

Commit

Permalink
Version release
Browse files Browse the repository at this point in the history
  • Loading branch information
ntorgov committed Jul 30, 2017
1 parent d11cae7 commit f30dde0
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 22 deletions.
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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+
11 changes: 8 additions & 3 deletions kadeshi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
44 changes: 28 additions & 16 deletions modules/thekadeshi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup(
name='theKadeshi',
version='0.0.8',
version='0.0.9',
url='https://thekadeshi.com',
license='MIT',
author='theKadeshi',
Expand Down

0 comments on commit f30dde0

Please sign in to comment.