mirror of
https://github.com/trustedsec/social-engineer-toolkit
synced 2025-03-03 06:47:31 +00:00
fix issue with wget not installed and fallback to urllib or urllib2
This commit is contained in:
parent
e26622c95a
commit
e436f21dba
4 changed files with 45 additions and 23 deletions
|
@ -1,3 +1,12 @@
|
|||
~~~~~~~~~~~~~~~~
|
||||
version 7.3.16
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
* fixed a bug that caused seautomatic to not detect full path of toolkit when launching from within directory
|
||||
* fixed a bug in seautomate that would not wait for commands to execute based on time delay when launching and causing it to not submit
|
||||
* fixed an issue where python3 would not import urllib.request
|
||||
* fixed an issue that would cause python2.7 not to work without wget installed
|
||||
|
||||
~~~~~~~~~~~~~~~~
|
||||
version 7.3.15
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
|
39
seautomate
39
seautomate
|
@ -43,6 +43,7 @@ if not os.path.isfile("/etc/setoolkit/set.config"):
|
|||
# try to import pexpect
|
||||
try:
|
||||
import pexpect
|
||||
|
||||
# if pexpect fails
|
||||
except ImportError:
|
||||
print("\n[*] PEXPECT is required, please download and install before running this...")
|
||||
|
@ -73,26 +74,27 @@ if os.path.isfile(filename):
|
|||
try:
|
||||
print("[*] Spawning SET in a threaded process...")
|
||||
child = pexpect.spawn("python setoolkit")
|
||||
child.expect("99\) Exit the Social-Engineer Toolkit")
|
||||
with open(filename) as fileopen:
|
||||
for line in fileopen:
|
||||
line = line.rstrip()
|
||||
# if we just use enter send default
|
||||
if line == "":
|
||||
line = "default"
|
||||
line = "blank line"
|
||||
|
||||
match1 = re.search("OMGPASSWORDHERE", line)
|
||||
if match1:
|
||||
line = line.replace("OMGPASSWORDHERE", "")
|
||||
password = True
|
||||
#match1 = re.search("OMGPASSWORDHERE", line)
|
||||
#if match1:
|
||||
# line = line.replace("OMGPASSWORDHERE", "")
|
||||
# password = True
|
||||
|
||||
if password is False:
|
||||
print("[*] Sending command {0} to the interface...".format(line))
|
||||
if password is True:
|
||||
print("[*] Sending command [**********] (password masked) to the interface...")
|
||||
password = False
|
||||
#if password is False:
|
||||
print("[*] Sending command {0} to the interface...".format(line))
|
||||
#if password is True:
|
||||
# print("[*] Sending command [**********] (password masked) to the interface...")
|
||||
# password = False
|
||||
|
||||
if line == "default":
|
||||
line = ""
|
||||
if line == "blank line":
|
||||
line = "\n"
|
||||
|
||||
if line == "CONTROL-C-HERE":
|
||||
try:
|
||||
|
@ -107,12 +109,13 @@ if os.path.isfile(filename):
|
|||
print("[-] Error: You are running pexpect < 2.3 which is needed for this function")
|
||||
choice = input("Would you like to install it now yes or no: ")
|
||||
if choice == "yes" or choice == "y":
|
||||
subprocess.Popen("wget http://sourceforge.net/projects/pexpect/files/pexpect/Release%202.3/pexpect-2.3.tar.gz;"
|
||||
"tar -zxvf pexpect-2.3.tar.gz;"
|
||||
"cd pexpect-2.3;"
|
||||
"python setup.py install;"
|
||||
"cd ..;"
|
||||
"rm -rf pexpect-2*", shell=True).wait()
|
||||
#subprocess.Popen("wget http://sourceforge.net/projects/pexpect/files/pexpect/Release%202.3/pexpect-2.3.tar.gz;"
|
||||
# "tar -zxvf pexpect-2.3.tar.gz;"
|
||||
# "cd pexpect-2.3;"
|
||||
# "python setup.py install;"
|
||||
# "cd ..;"
|
||||
# "rm -rf pexpect-2*", shell=True).wait()
|
||||
subprocess.Popen("pip install pexpect", shell=True).wait()
|
||||
try:
|
||||
reload(pexpect)
|
||||
child.sendcontrol('c')
|
||||
|
|
|
@ -1 +1 @@
|
|||
7.3.15
|
||||
7.3.16
|
||||
|
|
|
@ -11,6 +11,11 @@ import time
|
|||
import re
|
||||
import shutil
|
||||
import urllib
|
||||
# needed for python3
|
||||
try: import urllib.request
|
||||
except ImportError:
|
||||
import urllib2
|
||||
pass
|
||||
operating_system = check_os()
|
||||
definepath = os.getcwd()
|
||||
|
||||
|
@ -151,10 +156,15 @@ try:
|
|||
# not as good as wget
|
||||
headers = {'User-Agent': user_agent}
|
||||
# read in the websites
|
||||
req = urllib.request.Request(url, None, headers)
|
||||
# read in the data from the initial request
|
||||
html = urllib.request.urlopen(req).read()
|
||||
# if length isnt much then we didnt get the site cloned
|
||||
try:
|
||||
req = urllib.request.Request(url, None, headers)
|
||||
# read in the data from the initial request
|
||||
html = urllib.request.urlopen(req).read()
|
||||
# if length isnt much then we didnt get the site cloned
|
||||
except AttributeError:
|
||||
req = urllib2.Request(url, headers=headers)
|
||||
html = urllib2.urlopen(req).read()
|
||||
|
||||
if len(html) > 1:
|
||||
# if the site has cloned properly
|
||||
site_cloned = True
|
||||
|
|
Loading…
Add table
Reference in a new issue