Skip to content

Commit

Permalink
Merge pull request #9 from chrismaddalena/dev
Browse files Browse the repository at this point in the history
Small bug fixes and cleaner HTML output
  • Loading branch information
chrismaddalena committed Jul 27, 2015
2 parents edd53e2 + 77f10da commit 86f19e8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
14 changes: 6 additions & 8 deletions lib/phishemail.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,13 @@ def decodeEmailText(ENCODING):
print bcolors.OKGREEN + "[+] " + bcolors.ENDC + "Decoding quoted-printable text."
#Decode the quoted-printable text
source = quopri.decodestring(encoded)
output = open('source.html', "w")
output.write(source)
output.close()
if ENCODING in ['base64', 'Base64', 'b64', 'B64']:
print bcolors.OKGREEN + "[+] " + bcolors.ENDC + "Decoding Base64 text."
#Decode the Base64 text
source = base64.b64decode(encoded)
output = open('source.html', "w")
output.write(source)
output.close()
output = open('source.html', "w")
output.write(source)
output.close()

#This is Step 2 - URLs are replaced with our phishing URLs and new text is saved to source.html
def replaceURL():
Expand All @@ -50,7 +47,7 @@ def replaceURL():
#Find all <a href... and replace URLs with our new text/URL
for link in soup.findAll('a', href=True):
link['href'] = '{{links.generic}}'
source = str(soup)
source = str(soup.prettify(encoding='utf-8'))
#Write the updated URLs to source.html while removing the [' and ']
output = open('index.html', "w")
output.write(source.replace('[','').replace(']',''))
Expand Down Expand Up @@ -101,8 +98,9 @@ def addTracking():
index = source.find(r"</body")
print bcolors.OKGREEN + "[+] " + bcolors.ENDC + "Closing body tag found at index " + str(index)
tracked = source[:index] + strTracking + source[index:]
soup = BeautifulSoup(tracked.replace('[','').replace(']',''))
output = open("index.html", "w")
output.write(tracked.replace('[','').replace(']',''))
output.write(soup.prettify(encoding='utf-8'))
output.close()
print bcolors.OKGREEN + "[+] " + bcolors.ENDC + "Tracking has been inserted."
except:
Expand Down
2 changes: 1 addition & 1 deletion lib/phishexit.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def replaceURL():
link['href'] = urlparse.urljoin(strURL, link['href'])
for link in soup.findAll('script', src=True):
link['src'] = urlparse.urljoin(strURL, link['src'])
source = str(soup)
source = str(soup.prettify(encoding='utf-8'))
#Write the updated URLs to source.html while removing the [' and ']
output = open("index.html", "w")
output.write(source.replace('[','').replace(']',''))
Expand Down
2 changes: 1 addition & 1 deletion lib/phishgate.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def replaceURL(strURL):
link['href'] = urlparse.urljoin(strURL, link['href'])
for link in soup.findAll('script', src=True):
link['src'] = urlparse.urljoin(strURL, link['src'])
source = str(soup)
source = str(soup.prettify(encoding='utf-8'))
#Write the updated URLs to source.html while removing the [' and ']
output = open("index.html", "w")
output.write(source.replace('[','').replace(']',''))
Expand Down
4 changes: 2 additions & 2 deletions lib/toolbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def startHTTPServer(PORT):
try:
httpd = SocketServer.TCPServer(("", PORT), handler)
print bcolors.OKGREEN + "[+] " + bcolors.ENDC + "Done. See output at 127.0.0.1:",PORT
print ncolors.WARNING + "[!] " + bcolors.ENDC + "Use CTRL+C to kill the web server."
print bcolors.WARNING + "[!] " + bcolors.ENDC + "Use CTRL+C to kill the web server."
httpd.serve_forever()
except:
print bcolors.FAIL + "[-] Server stopped or could not be started. Check port number." + bcolors.ENDC
Expand All @@ -66,4 +66,4 @@ def encodeImage(IMAGE):
print bcolors.OKGREEN + "[+] " + bcolors.ENDC + "Image has been encoded. Copy this string:\n"
img_64 = base64.b64encode(image.read())
print img_64 + "\n"
print ncolors.OKGREEN + "[+] " + bcolors.ENDC + "End of encoded string."
print bcolors.OKGREEN + "[+] " + bcolors.ENDC + "End of encoded string."

0 comments on commit 86f19e8

Please sign in to comment.