Skip to content

Commit

Permalink
News 20/01/2022 02:08
Browse files Browse the repository at this point in the history
  • Loading branch information
CYB3RMX committed Jan 19, 2022
1 parent a0254d1 commit 6b4b053
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 42 deletions.
Binary file removed .animations/update.png
Binary file not shown.
4 changes: 2 additions & 2 deletions Modules/checkHealth.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
homeD = "/Users"

# Commit
latest_commit = "14/01/2022"
latest_commit = "20/01/2022"

# Checking for latest commits
print(f"{infoS} Checking for latest commit...")
Expand All @@ -58,7 +58,7 @@

# Resource checks
user_directory = f"{homeD}/{username}/sc0pe_Base"
resource = {"HashDB.json": "Malware Hash Database",
resource = {"HashDB": "Malware Hash Database",
"sc0pe_VT_apikey.txt": "VirusTotal API key"}
print(f"{infoS} Checking for resources...")
for res in resource:
Expand Down
64 changes: 28 additions & 36 deletions Modules/hashScanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@
import hashlib
import sys
import math
import json
import getpass

try:
import sqlite3
except:
print("Module: >sqlite3< not found.")
sys.exit(1)

# Module for progressbar
try:
from tqdm import tqdm
Expand Down Expand Up @@ -61,12 +66,12 @@
install_dir = f"{homeD}/{username}/sc0pe_Base"

def DatabaseCheck():
if os.path.isfile(f"{install_dir}/HashDB.json") == False:
if os.path.isfile(f"{install_dir}/HashDB") == False:
print(f"{errorS} Local signature database not found.")
choose = str(input(f"{green}=>{white} Would you like to download it [Y/n]?: "))
if choose == "Y" or choose == "y":
local_database = f"{install_dir}/HashDB.json"
dbUrl = "https://raw.githubusercontent.com/CYB3RMX/MalwareHashDB/main/HashDB.json"
local_database = f"{install_dir}/HashDB"
dbUrl = "https://raw.githubusercontent.com/CYB3RMX/MalwareHashDB/main/HashDB"
req = requests.get(dbUrl, stream=True)
total_size = int(req.headers.get('content-length', 0))
block_size = 1024
Expand Down Expand Up @@ -96,10 +101,10 @@ def GetHash(targetFile):
return hashMd5.hexdigest()

# Accessing hash database content
try:
with open(f"{install_dir}/HashDB.json") as databaseFile:
hashData = json.load(databaseFile)
except:
if os.path.exists(f"{install_dir}/HashDB"):
hashbase = sqlite3.connect(f"{install_dir}/HashDB")
dbcursor = hashbase.cursor()
else:
DatabaseCheck()

# Handling single scans
Expand All @@ -112,34 +117,22 @@ def NormalScan():
answTable.field_names = [f"{green}Hash{white}", f"{green}Name{white}"]

# Total hashes
tot = 0
try:
for hh in hashData:
if hh['hash'] != "":
tot += 1
except:
pass

# Finding target hash
foundc = 0
try:
for hashes in hashData:
if hashes['hash'] == targetHash:
answTable.add_row([f"{red}{targetHash}{white}", f"{red}{hashes['name']}{white}"])
foundc += 1
break
except:
pass
database_content = dbcursor.execute(f"SELECT * FROM HashDB").fetchall()

# Printing informations
print(f"{infoS} Total Hashes: {green}{tot}{white}")
print(f"{infoS} Total Hashes: {green}{len(database_content)}{white}")
print(f"{infoS} File Name: {green}{targetFile}{white}")
print(f"{infoS} Target Hash: {green}{targetHash}{white}\n")
if foundc != 0:

# Finding target hash in the database_content
db_answer = dbcursor.execute(f"SELECT * FROM HashDB where hash=\"{targetHash}\"").fetchall()
if db_answer != []:
answTable.add_row([f"{red}{db_answer[0][0]}{white}", f"{red}{db_answer[0][1]}{white}"])
print(f"{answTable}\n")
else:
print(f"{errorS} Target hash is not in our database.")
print(f"{infoS} Try {green}--analyze{white} and {green}--vtFile{white} instead.\n")
hashbase.close()

# Handling multiple scans
def MultipleScan():
Expand All @@ -164,14 +157,13 @@ def MultipleScan():
scanme = f"{targetFile}/{allFiles[tf]}"
targetHash = GetHash(scanme)

# Finding target hash
try:
for hashes in hashData:
if hashes['hash'] == targetHash:
mulansTable.add_row([f"{red}{allFiles[tf]}{white}", f"{red}{targetHash}{white}", f"{red}{hashes['name']}{white}"])
multimalw += 1
except:
pass
# Finding target hash in the database_content
db_answers = dbcursor.execute(f"SELECT * FROM HashDB where hash=\"{targetHash}\"").fetchall()
if db_answers != []:
mulansTable.add_row([f"{red}{allFiles[tf]}{white}", f"{red}{db_answers[0][0]}{white}", f"{red}{db_answers[0][1]}{white}"])
multimalw += 1
hashbase.close()

# Print all
if multimalw != 0:
print(f"\n{mulansTable}\n")
Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@ python3 qu1cksc0pe.py --file suspicious_file --analyze
![Screen](.animations/Screenshot.png)

# Updates
<b>14/01/2022</b>
- [X] ```Setup Health Checker``` module is upgraded.
- <b>Usage</b>: ```python3 qu1cksc0pe.py --health```<br>
![update](.animations/update.png)
<b>20/01/2022</b>
- [X] ```HashScanner module``` is upgraded.

# Available On
![blackarch_banner](.animations/blackarch.png)
Expand Down

0 comments on commit 6b4b053

Please sign in to comment.