mirror of
https://github.com/trustedsec/social-engineer-toolkit
synced 2025-03-03 06:47:31 +00:00
add update delay for initial load check - currently set to 8 seconds
This commit is contained in:
parent
233d7fe036
commit
2abc828584
3 changed files with 38 additions and 15 deletions
|
@ -16,6 +16,8 @@ version 7.3
|
|||
* cleaned up setup file and added better descriptions
|
||||
* fixed a bug that would cause fsattack to not load properly
|
||||
* moved from pulling entire setcore which is a few thousand lines to adding src/core/set.version which contains the version - much faster in pulling down
|
||||
* fixed a bug in dell drac that caused it to error out
|
||||
* added timeout delay for pulling new version biggest challenge here is that urllib base is socket and socket timeout is tied to gethostbyname() which does not support a timeout, needed to add multiprocessing poll for 8 seconds to add timeout delay when checking for updates
|
||||
|
||||
~~~~~~~~~~~~~~~~
|
||||
version 7.2.3
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
#
|
||||
# Centralized core modules for SET #
|
||||
# Centralized core modules for SET
|
||||
#
|
||||
#
|
||||
import re
|
||||
import sys
|
||||
|
@ -17,7 +18,12 @@ import base64
|
|||
from src.core import dictionaries
|
||||
import io
|
||||
import trace
|
||||
from urllib import *
|
||||
#python 2 and 3 compatibility
|
||||
try:
|
||||
from urllib.request import urlopen
|
||||
except ImportError:
|
||||
from urllib import urlopen
|
||||
import multiprocessing
|
||||
|
||||
if sys.version_info >= (3, 0):
|
||||
# python 3 removes reduce from builtin and into functools
|
||||
|
@ -252,7 +258,7 @@ def print_error(message):
|
|||
"[!] " + bcolors.ENDC + bcolors.RED + str(message) + bcolors.ENDC)
|
||||
|
||||
def get_version():
|
||||
define_version = file("src/core/set.version", "r").read().rstrip()
|
||||
define_version = open("src/core/set.version", "r").read().rstrip()
|
||||
#define_version = '7.2.3'
|
||||
return define_version
|
||||
|
||||
|
@ -829,17 +835,33 @@ def show_banner(define_version, graphic):
|
|||
# pull version
|
||||
try:
|
||||
version = ""
|
||||
if not os.path.isfile(setdir + "/version.lock"):
|
||||
version = urlopen('https://raw.githubusercontent.com/trustedsec/social-engineer-toolkit/master/src/core/set.version').read().rstrip()
|
||||
filewrite = file(setdir + "/version.lock", "w")
|
||||
filewrite.write(version)
|
||||
filewrite.close()
|
||||
def pull_version():
|
||||
if not os.path.isfile(setdir + "/version.lock"):
|
||||
url = ('https://raw.githubusercontent.com/trustedsec/social-engineer-toolkit/master/src/core/set.version')
|
||||
version = urlopen(url).read().rstrip().decode('utf-8')
|
||||
filewrite = open(setdir + "/version.lock", "w")
|
||||
filewrite.write(version)
|
||||
filewrite.close()
|
||||
|
||||
else: version = open(setdir + "/version.lock", "r").read()
|
||||
else: version = open(setdir + "/version.lock", "r").read()
|
||||
|
||||
if cv != version:
|
||||
if version != "":
|
||||
print(bcolors.RED + " There is a new version of SET available.\n " + bcolors.GREEN + " Your version: " + bcolors.RED + cv + bcolors.GREEN + "\n Current version: " + bcolors.ENDC + bcolors.BOLD + version + bcolors.YELLOW + "\n\nPlease update SET to the latest before submitting any git issues.\n\n" + bcolors.ENDC)
|
||||
if cv != version:
|
||||
if version != "":
|
||||
print(bcolors.RED + " There is a new version of SET available.\n " + bcolors.GREEN + " Your version: " + bcolors.RED + cv + bcolors.GREEN + "\n Current version: " + bcolors.ENDC + bcolors.BOLD + version + bcolors.YELLOW + "\n\nPlease update SET to the latest before submitting any git issues.\n\n" + bcolors.ENDC)
|
||||
|
||||
# why urllib and sockets cant control DNS resolvers is beyond me - so we use this as a hack job to add a delay and kill if updates are taking too long
|
||||
p = multiprocessing.Process(target=pull_version)
|
||||
p.start()
|
||||
|
||||
# Wait for 5 seconds or until process finishes
|
||||
p.join(8)
|
||||
|
||||
# If thread is still active
|
||||
if p.is_alive():
|
||||
print(bcolors.RED + " Unable to check for new version of SET (is your network up?)\n" + bcolors.ENDC)
|
||||
# terminate the process
|
||||
p.terminate()
|
||||
p.join()
|
||||
|
||||
except Exception as err:
|
||||
print(err)
|
||||
|
|
|
@ -18,7 +18,6 @@ import threading
|
|||
import sys
|
||||
import time
|
||||
|
||||
|
||||
class bcolors:
|
||||
PURPLE = '\033[95m'
|
||||
CYAN = '\033[96m'
|
||||
|
@ -80,7 +79,7 @@ print("media device.")
|
|||
print("")
|
||||
print("Enter the IP Address or CIDR notation below. Example: 192.168.1.1/24")
|
||||
print("")
|
||||
ipaddr = input("Enter the IP or CIDR: ")
|
||||
ipaddr = raw_input("Enter the IP or CIDR: ")
|
||||
|
||||
# try logging into DRAC, chassis is something different
|
||||
|
||||
|
@ -351,4 +350,4 @@ else:
|
|||
" Sorry, unable to find any of the Dell servers with default creds..Good luck :("))
|
||||
|
||||
|
||||
input("Press {return} to exit.")
|
||||
raw_input("Press {return} to exit.")
|
||||
|
|
Loading…
Add table
Reference in a new issue